Prompt stringlengths 14 160 | Instruction stringlengths 18 2k | Response stringlengths 8 2k |
|---|---|---|
nginx, passenger only showing root page, all other routes fail | Nginx + passenger is only showing the root page / path, all other routes fail with 404 Not Found.
I know nginx and passenger must be running to correctly bring up the root path. Here's the entry for sites-available:server {
listen 80;
server_name staging.redacted.com; # Replace this with your site's domain.... | Try removingtry_files $uri $uri/ =404;Remove or comment out thetry_filesline completely and it will work. |
How do I redirect all requests that contains a certain string to 404 in nginx? | I want to return all requests to urls that contains the stringHistatsto 404. How can I do that? | location ~ Histats {
return 404;
}PS:If is evil |
nginx big header response | "upstream sent too big header while reading response header from upstream"I keep getting this when I try and do an authentication from facebook. I've increased my buffers:proxy_buffer_size 256k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 512k;
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;But it doesn't see... | Turns out Codeigniter sets its own max size. I haven't figured out how to limit that, but changing nginx won't change anything unfortunately. Thanks for all the help VBart and gsharma. |
nginx: redirect mobile requests to /mobile/$uri | I am trying to setup my nginx to redirect all the requests from mobile devices to /mobile/$uri
i came up with this solution but it doesn't seem to work. Is it a syntax problem or a misunderstanding of the whole redirecting concept.if ($http_user_agent ~* '(iPhone|iPod|android|blackberry)') {
rewrite ^(.*) ht... | #initliaze mobile
set $mobile "";
if ($request_uri !~* "^/mobile.*" ){
set $mobile Y;
}
if ($http_user_agent ~* (iPhone|iPod|android|blackberry) ) {
set $mobile "${mobile}E";
}
if ( $http_referer !~* "xxx\.org" ){
set $mobile "${mobile}S";
}
if ( $host ~* "xxx\.... |
Complex nginx rewrite rules for subdomains | I currently have the following (hacky) re-write rule in my nginx.conf to allow dynamic sub-domains to be re-directed to one Django instance.set $subdomain "";
set $subdomain_root "";
set $doit "";
if ($host ~* "^(.+)\.domain\.com$") {
set $subdomain $1;
set $subdomain_root "/profile/$subdomain";
set $doit T... | Actually I think it is much easier to change the nginx re-write rules than to write middleware for django to do this. After reading up on how nginx processes it's location matching (most exact -> least exact) I created locations for /media and /download as well as a catch all location for / I then moved the rewrite rul... |
Can nginx run a unix command based on url? | Is it possible to configure nginx to run a unix command based on a url?For example:http://localhost/list/usr/localThis runs:ls /usr/localThen returns the results? | No, Nginx cannot. |
How can I change the docker jwilder/nginx-proxy upload limits? | In my architecture I use the /jwilder/nginx-proxy as a proxy server in my docker and then I installed 3 WordPress websites with MySQL and WordPress.They are working well but /jwilder/nginx-proxy has a default configuration upload limit to 2MB but my WordPress template is about 20MB.When I am trying to upload this templ... | After searching, I create a file outside the container calledclient_max_body_size.confwith the contentsclient_max_body_size 25m;(or whatever) and bind mount it into your nginx-proxy container:docker run -d --name nginx-proxy -v /var/run/docker.sock:/tmp/docker.sock \
-v $ /client_max_body_size.conf:/etc/nginx/conf.... |
Nginx proxy_cache caches 502 errors | I'm using Nginx proxy_cache to cache responses from a Node server. When that server is offline Nginx returns a custom 502 page. All going well so far...When the Node server comes back online Nginx keeps returning the 502 page for 5 mins (my cache time). If I delete all the files in the cache dir it makes no difference.... | I managed to figure this out myself. Nginx really does cache the knowledge that the upstream server is inaccessible.To fix this I changed my cache config fromproxy_cache_valid any 5m;toproxy_cache_valid 5m;Removinganyimplies you only want to cache 200, 301, and 302 responses. |
nginx location index directive not working | I'm new to nginx and I just can't determine why my nginx config doesn't work as expected. All I want to do is to make nginx prioritize index.html over index.php for every web root (/) request.This is my nginx config:user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
mul... | Convention:You should keep location and server declarations in virtual host files (/etc/nginx/conf.d/*.conf;and/etc/nginx/sites-enabled/*;, as you can see from the nginx conf). Files in/etc/nginx/conf.d/*.conf;are typically symlinked to files in/etc/nginx/sites-enabled/*;in order to become "enabled"Some things to trySe... |
Kubernetes NGINX Ingress: Disable external auth for specific path | I would like to be able to disable external authorization for a specific path of my App.Similiar to this SO:Kubernetes NGINX Ingress: Disable Basic Auth for specific pathOnly difference is using an external Auth provider (OAuth via Microsoft Azure) and there is aThis is the path that should be reachable by the public/M... | Because you already haveingressin place and the path is/, there will be no way of disabling the basic auth on yourhttps://externalprovider/oauth2/auth.For best explanation please refer to answer provided by@VASbelow.To do that, you need to set up anotheringressand configure it to disable basic auth.
You can also check ... |
Twitter tracking pixel causing MIME type error | I'm trying to loadTwitter's tracking pixelon my Meteor/NodeJS website.The code they provide is:!(function(e, t, n, s, u, a) {
e.twq ||
((s = e.twq = function() {
s.exe ? s.exe.apply(s, arguments) : s.queue.push(arguments);
}),
(s.version = "1.1"),
(s.queue = []),
... | TLDR: This scary error message proves the conversion/s are actually being received by Twitter, so thankfully there's not much to worry about.I'm getting the same console error when implemented as perTwitter's Google Tag Manager instructions. Clearing out cookies didn't help in my instance. In fact, the same error sho... |
req.protocol never gives https behind nginx proxy | I'm trying to recognise whether my express app is serving over anhttpsprotocol.Usingnginxto handle the certification and encryption (on the same machine), and forward requests,req.protocolevaluates tohttpeven when https is being used and working fine.I've tried both of the following (individually):app.set('trust proxy'... | I needed to add this to my nginx block:proxy_set_header X-Forwarded-Proto https;🙈 |
Kibana4 to listen on Port 80 instead of Port 5601 | I have elasticsearch 1.4 and kibana4 running on an Amazo EC2 instance running RHEL7.Kibana4 is running as a standalone process and is not deployed in a web container such as nginx.It is listening on Port 5601.(the default port). I would like to have kibana listen on port 80.Can this be achieved without using nginx? If ... | Edit file {kibana-directory}/config/kibana.yml. Find this line:port: 5601and change it to:port: 80 |
Can Windows PHP-FPM serve multiple simultaneous requests? | I'm currently usingnginxandPHP FastCGIbut that arrangement suffers from the limitation that it can only serve one HTTP request at a time. (Seehere.) I start PHP from the Windows command prompt by doing;c:\Program Files\PHP>php-cgi -b 127.0.0.1:9000However there is another way to run PHP know as "Fast CGI Process Manage... | I ended up with this solution: you simply start several php-cgi processes and bind them to different ports, and you need to update nginx config:http {
upstream php_farm {
server 127.0.0.1:9000 weight=1;
server 127.0.0.1:9001 weight=1;
server 127.0.0.1:9002 weight=1;
server 127.0.0.1... |
Routing requests through index.php with nginx [closed] | Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed11 years ago.Improve this questionI'm migrating my server from Apache to Nginx and have this very simple.htaccessrule:RewriteEngine On
RewriteCond %{REQUEST_F... | This is how I route EVERYTHING to index.php, including sub-directory requests, HTTP args, ect.location / {
try_files $uri $uri/ /index.php?$args; #if doesn't exist, send it to index.php
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
# By all means use a different server for ... |
Hosting a Rails Application on Linode | I'm planning to host a Rails application on Linode, but I'm still unsure about the requirements and process of deploying. I'm only getting the 512 plan since I'm expecting relative small traffic for the site.My question is, do I need to get a repository such as Github to store my code? I'm also a bit concerned about ho... | I've deployed a couple of simple applications on Linode and found their documentation to be excellent. In particular they have step-by-step tutorials tailored to specific environments. For example, in my case (like you) I wanted to use nginx, and I was using Ubuntu 10.04, so I followed this guide:http://library.linode.... |
Why install server (Nginx, Apache...) with Node.js? [duplicate] | This question already has answers here:Closed11 years ago.Possible Duplicate:Why do we need apache under Node.js express web framework?I wonder why I should install a server such as Nginx or Apache with Node.js. I used to think that the server can help me to handle cache control or something more. But I found out that ... | If you don't know why you need Nginx or Apache on top of Node.js, then you don't need it.Nginx does a few things faster (and in some cases easier to configure) than Node.js: proxying, url rewriting, http caching, redirection, static file serving, and load balancing.If you experience that your Node.js code for any of th... |
Nginx proxy_pass to a password protected upstream | I want to pass a request to an upstream server. The original url is not password protected but the upstream server is. I need to inject a Basic auth username/password into the request but get errors when doing:upstream supportbackend {
server username:[email protected];
}andupstream supportbackend {
ser... | you need to addproxy_set_header Authorization "Basic ....";where the....is base64 ofuser:pass. |
Docker build from Dockerfile shows "ADD failed - No such file or directory" | When I try to build the following (simple) NGINX docker containerhttps://github.com/MarvAmBass/docker-nginx-ssl-secure, it always fails with the following error:stat /var/lib/docker/tmp/docker-builder00Whatever/basic.conf: no such file or directoryMy directory looks like this:├── basic.conf
├── Dockerfile
├── entrypoin... | Ok, for me it worked to usedocker build . -f Dockerfileinstead ofdocker build - < Dockerfile(which was the suggestion from the offical docker documentation by the way:https://docs.docker.com/engine/reference/commandline/build/#tarball-contexts). The solution was taken from github:https://github.com/moby/moby/issues/349... |
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) even after killing the process using port 80 | I'm trying to start nginx as follows:kurt@kurt-ThinkPad:~$ which nginx
/usr/sbin/nginx
kurt@kurt-ThinkPad:~$ sudo /usr/sbin/nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98... | You should run thisuser@user ~ $ sudo netstat -tulpn | grep --color :80it will show you process idtcp6 0 0 :::80 :::* LISTEN 2063/apache22063/apache2 – PID/Process name |
Does NginX(Open source, not Nginx plus), supports API Gateway? | Does NginX(Open source, not Nginx plus), supports API Gateway?
Please, help me get to the valid documentation or information. Thank you! | Unfortunately the Nginx Api Gateway is featured only in Nginx Plus. But there isKong, an alternative that is built on top of Nginx and is also open source.There is even a post on Nginx's official blog about it:https://www.nginx.com/blog/nginx-powers-kong-api-management-solution/Edit: The blog post has been replaced by ... |
Why am i getting error: recv() failed (104: Connection reset by peer) while reading response header from upstream during ajax request | I had problem with ajax. It always stopped working 5 min after request. I did't know what was causing it. I looked on many pages to find a sollution but nor provide good one. What I can do ? | You need to check what you have set in /etc/php5/fpm/pool.d/www.conf file in line request_terminate_timeout. I has got:request_terminate_timeout = 300sThis is because it had always stopped working after 5 min (300s = 5min)After i changed it torequest_terminate_timeout = 3600smy problem have gone. I have got now 60 min ... |
Nginx permission issue (404) | Trying to get let's encrypt setup using the webroot method, which creates and needs to access files in the ./.well-known/acme-challenge/ directory. Everything there (including the manual test file I added) shows up as 404.Going kind of crazy as I've tried variants of:location ~ /.well-known {
allow all;
}
location... | Your firstserverblock needs arootdirective to resolve local files.Seethis documentfor more. |
nginx rewrite all to index.php except whitelist | First of all, I have tried to search for similar questions, but the solutions to those questions were specific lines of code, that I couldn't customise to fit my needs.I have a Codeigniter installation, and I'm trying to migrate from Apache to nginx. However, in Apache the .htaccess was pretty simple: it would take a w... | I would use the$urivariable andifin alocationblock to achieve this.location / {
if ( $uri !~ ^/(index\.php|css|images|core|uploads|js|robots\.txt|favicon\.ico) ) {
rewrite ^ /server/index.php last;
}
}Also, as for thepathinfo security problems, (discussion) it's a good practice to addtry_files $uri =403... |
Can my /public directory be a symlink with rails 3 + passenger 3 + nginx 0.8? | I'm putting together a rails deployment where the public directory is a
symlink to another directory on the system. This is with passenger 3 on
nginx .8. It does't seem to like that setup. Nginx always follows symlinks by default, so AFAIK it's not a matter of doing the equivalent of Apache's +FollowSymLinks.updateLo... | I think it is not possible to use a symlinked public directory. The only workaround I can imagine is to symlink any file and directory inside of the public dir.# public folder: /data/public
# app folder: /webapp/
mkdir -p /webapp/public && ln -sf /data/public/* /webapp/public/For every new file or directory in /data/pu... |
Problem installing nginx on ubuntu 20.04 AWS EC2 node | I try to install nginx on an Ubuntu 20.04 AWS EC2 server by doing:sudo apt update
sudo apt upgrade
sudo apt install nginxHowever the last command fails:Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
reques... | Try the following:echo "deb http://security.ubuntu.com/ubuntu bionic-security main" | sudo tee -a /etc/apt/sources.list.d/bionic.list
sudo apt update
apt-cache policy libssl1.0-dev
sudo apt-get install libssl1.0-dev |
How to create nginx ingress in terraform - aks | How can i create anginx ingressinazure kubernetesusingterraform, earlier in thislink, i remember seeing some steps as a mandatory installation for all setups, right now it seems to be removed and there is a specific way of installing foraksin thislink, should i rewrite all these to adapt toterraformor is there any othe... | You could try using Terraform's helm provider.provider "helm" {
kubernetes {
host = azurerm_kubernetes_cluster.your_cluster.kube_config.0.host
client_key = base64decode(azurerm_kubernetes_cluster.your_cluster.kube_config.0.client_key)
client_certificate = base64decode(azu... |
How to install a module on nginx? | When running nginx -t I get this error:nginx: [emerg] unknown directive "subs_filter_types" in /etc/nginx/sites-enabled/my.site.com.conf:285
nginx: configuration file /etc/nginx/nginx.conf test failedSo I need to install the substitution filter module and in the nginx documentationhttps://www.nginx.com/resources/wiki/m... | The instructions you are referring to are for compiled installation.Assuming you want to add the moduleto your existingNGINX install, below are the generic steps that will get things running.Fetch exactly matching version of NGINX as the one you have installed, from nginx.org onto your system and extract it to, say,/us... |
Converting a high performance web service from Nginx on AWS EC2 to AWS Lambda | On a project I’m working on, there are a number of web services implemented on AWS. The services that are relatively simple (DynamoDB insert or lookup) and will be used relatively infrequently have been implemented as Lambdas, which were perfect for the task. There is also a more complex web service which does a lot of... | Can Lambda do it? Yes. Should Lambda do it? No.Why? Cost.First, let's say you do handle20k Requests / Second, every second for an entire day. That will then equate to1.728 Billionrequests in that day. In the free tier, you do get 1 Million requests free, so that drops the billable requests down to 1.727 Billion. Lambda... |
Unable to get go.net/websocket working behind nginx | I'm having trouble getting go.net/websocket to work behind nginx. It works if the application is accessed directly but with nginx, I get an EOF error from Receive.What am I doing wrong?Nginx version: 1.5.10This is my nginx configuration.location /wstest/ {
proxy_pass http://localhost:7415/;
proxy_http_version 1... | This is the configuration that I'm using, it's working OK:server {
listen 0.0.0.0:20007;
index index.html;
root /full/path/to/site;
# pass the request to the node.js server with the correct headers
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarde... |
Nginx rewrite only when root domain | I'd like to do an Nginx rewrite where I have two domains: domain.com and domain.net with the following rules:1) If a user goes tohttp://www.domain.net/, he will be redirected tohttp://www.domain.com/2) If a user goes tohttp://www.domain.net/anything_else.htmlthe rewrite will not occur.This is my failed attempt:server {... | Maybe this works:server {
listen 80;
server_name www.domain.net domain.net;
location / {
rewrite "^$" http://www.domain.com/ permanent;
}
} |
Connection Refused with nginx and kubernetes | I trying to deploy my angular application with kubernates inside a container with nginx.I create my docker file:FROM node:10-alpine as builder
COPY package.json package-lock.json ./
RUN npm ci && mkdir /ng-app && mv ./node_modules ./ng-app
WORKDIR /ng-app
COPY . .
RUN npm run ng build -- --prod --output-path=dist
... | I found the solution. The problem was with my requests, I was usinglocalhostat the URL, with that I took the wrong pod IP. I've just changed the request to use straight the service IP and that sort out my problem. |
How to read nginx access.log? | My server is compiled on a docker.The Nginx container is built from a standard assembly.I want to read the access.log nginx but I see this kind of content:172.68.244.173 - - [24/Aug/2018:12:14:04 +0000] "\x16\x03\x01\x00\xEC\x01\x00\x00\xE8\x03\x03\x8A?\xB5\xFA\x17?\x8A\x9B\x04T>yK\x1A\xF6\x8F_\xBE:.\xF9\xED\xF6\xEE\xF... | According tonginx documentationthe default access log format is:log_format combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';Applied to your log line:$remote_addr = 172.68.244.173
(literal string fo... |
Nginx: Permission denied to Gunicorn socket on CentOS 7 | I'm working in a Django project deployment. I'm working in a CentOS 7 server provided ma EC2 (AWS). I have tried to fix this bug by many ways but I cant understand what am I missing.I'm using ningx and gunicorn to deploy my project. I have created my/etc/systemd/system/myproject.servicefile with the following content:[... | If all the permissions under themyproject_appfolder are correct, andcentosuser ornginxgroup have access to the files, I would say it looks like a Security Enhanced Linux (SELinux) issue.I had a similar problem, but with RHEL 7. I managed to solve it by executing the following command:sudo semanage permissive -a httpd_t... |
nginx logs are out of order, probably due to buffered logging | Records in my nginx log file are out of order. (Edit: by "out of order" I mean chronologically. e.g. Log lines for 2017-02-21 09:13:26 will often bebeforelines for 2017-02-21 09:13:45) Perhaps a certain amount of out of order records are to be expected because they are logged after a request is completed, not when rece... | Yes, it's buffering issue. If you are using few workers - each worker has own buffer.Ways to improve:disable bufferingdecrease buffer size (1)addflushoptions, if
flush to disk still rarecreate own log collector with sorting
(nginx can syslog protocol, for example)But usually you don't need to care about order of log re... |
Set constant SERVER_NAME with nginx | I havenginx.confwith following structure:http {
[ ... ]
server {
[ ... ]
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
... | Multiplefastcgi_paramstatements (at the same block level) setting the same parameter will silently use the value from the last statement.This includes statements read via anincludedirective.Always declarefastcgi_paramstatements after theinclude fastcgi_params;statement to avoid any ambiguity in your configuration files... |
Nginx, fastcgi PHP Windows, No input file specified | Running php-cgi on port 9000Netstat gives meTCP 127.0.0.1:9000 DESKTOP-xxxxxxx:0 LISTENING
[php-cgi.exe]nginx.confhttp://pastebin.com/wkfz8wxwEvery php file gives me thisNo input file specified.error...ChangedSCRIPT_FILENAMEtoSCRIPT_NAMEand no succes..I am on Windows 10 Home x64 | You need to set a document root with therootdirective, either within yourlocation ~ \.php$block or inherited from the outerserverblock.The solution may be to move theroot c:/Users/Youri/PhpstormProjects;line out of yourlocation /block into a position above it.Usuallyfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_... |
Trying to increase nginx buffer | I have the nginx server running fine with this config.server {
location / {
proxy_pass http://127.0.0.1:8000;
}
}but when I try and modify buffer size it fails.server {
location / {
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
... | Theclient_header_buffer_sizeis not available within the "location" context. You'll also need to move thelarge_client_header_buffersMove them to within the "server" context and it'll work.server {
client_header_buffer_size 1k;
large_client_header_buffers 2 1k;
location / {
client_body_buffer_size 10... |
Are websockets the right technology to be used to update progress bars for the client and how to implement it? [closed] | Closed. This question isopinion-based. It is not currently accepting answers.Want to improve this question?Update the question so it can be answered with facts and citations byediting this post.Closed9 years ago.Improve this questionScenarioI am developing some sort of web based cloud storage service.One feature is tha... | Did you take a look atServer Sent Eventsas you are initiating your request via ajax so you aren't performing bidirectional communication; you only want server to push you updates when it has ones |
Is it possible to have a root path containing spaces in my nginx.conf | I have tried escaping (and not escaping), with (and without) single quotes double qoutes but i always end up on the 404 page.is it even possible? i tried searching for it, but landed ofhttps://serverfault.com/questions/361915/how-can-i-make-nginx-recognise-directories-with-spaces-in-its-namebut i already tried that, an... | I just ran into this issue, too. As long as I did not escape the spaces and used single or double quotes, I was able to use a root path with spaces.the following worksroot "/directory/with spaces not escaped/will work"this does not workroot "/directory/with\ escaped\ spaces/will\ not\ work" |
Can't hide location's port with nginx | I'm trying to set up a domain for my node project with nginx (v1.5.11), i have succesfull redirected the domain to the web, but i need to use 3000 port, so now, my web location looks likehttp://www.myweb.com:3000/and of course, i want to keep only "www.myweb.com" part like this:http://www.myweb.com/I have search and tr... | Add this to yourserverblock:port_in_redirect off;E.g.server {
listen 80;
server_name localhost;
port_in_redirect off;
}Documentation reference.You should also change server_name tomyName.server_nameshould be your domain name.You should also be listening on port80, and then use proxy_pass to redirect ... |
Error Logging in Nginx+Gunicorn+Supervisor+Django | The I am logging all the caught errors in the django app in the django logger. Where do the errors that do not get caught go? It should go to supervisor log file, in my opinion. But that is empty. | According to nginxdocs, add line to your configuration file.access_log /path/to/your/logs/nginx_access.log;
error_log /path/to/your/logs/nginx_error.log info;To log with supervisor, you can add lines to your configuration file like this[program:program]
command=/virtualenv/python /path/to/django/source/manage.py run_... |
Redirecting all requests that aren't from my IP with nginx | I want all nginx requests that aren't made by my IP address to be redirected to/some-page. I'm currently using this nginx config:if ($remote_addr != 127.0.0.1) {
rewrite ^ http://www.example.com/some-page;
}This works for me as I'm not redirected, but anyone else is stuck in a redirect loop since the block ... | If thisifis created inside thelocation /for example, create a separatelocation /some-pagethis way theifwon't be executed when the URI is/some-pageEDIT: ok let me explain what i understood and you tell me if i'm right or wrong,Good IP (yours): serve page as it isBad IP (not yours): redirect to/some-pageThe problem is, w... |
How to tell nginx to redirect all pages of the website to root? [closed] | Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed11 years ago.Improve this questionI'm closing down a website and I need nginx to redirect all users to the root and not just show them the same page on all web... | The following should do what you want:server {
listen 80;
root /var/www/mysite;
location = / { try_files /index.html = 404;}
location / { rewrite ^ / permanent; }
} |
Does nginx buffer its error logs? | We're looking to watch nginx error logs for modifications but having some difficultly accounting for edge cases such as file truncations, etc.It would be helpful to know if nginx writes its error log files on the fly or if it buffers writes to error logs. Buffering wouldnt make a lot of sense for error logs but could s... | No, error log writes aren't buffered. |
Nginx server contents gzip compress not working | This is the portion in my nginx.conf but i not sure why when i check with gzip compression checker or http header, the content is not compress.https://pasify.comuser nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/er... | Bygzip_disable MSIE [1-6].(?!.*SV1);you've disabled gzip for almost any browser which has digits in it's User-Agent, as there are two separate regular expressions: "MSIE" and "[1-6].(?!.*SV1)". Add quotes around or better use this instead:gzip_disable msie6;Seedocsfor details. |
Multiple IPs+domains+SSL certs for one web site | I would like to have two domains, each with their own SSL cert, each SSL cert has its own IP of course, to point to the same web site on one physical server. The server will have to have two IPs too of course. What is this called? How is this done with nginx? OS is Linux. Thanks! | Create twoserverentries with differentlistenandssl_certificate(_key)directives using the different IP addresses but the samerootwhere your shared web pages are stored. For example:server {
listen 1.2.3.4:443;
server_name first-domain.example;
root /srv/html/shared_domain_data;
ssl on;
ssl_certificate /etc/ng... |
Hosting multiple ASP NET Core sites on unbuntu and nginx as reverse proxy | I am trying to host multiple ASP NET Core sites with different domains on Linux, Unbunt 18.04 and using nginx as reverse proxy.These are the steps:1) Creating new .conf files in /etc/nginx/sites-available2) Creating folders in /var/www/ and uploadin the .net app3) Creating new .service files for each .conf fileThe defa... | I had a similar issue.Each of your applications nginx config files should point to the correct port number that the .Net Core application is set to run on.This is determined in each of your .Net Core applicationsprogram.csin the.UseUrls()extension, e.g.public static IWebHost CreateWebHostBuilder(string[] args) =>
... |
NGINX proxy to a Zeit Now deployment | I have several application server running several Node applications (via PM2).I have one NGINX server which has the SSL certificate for the domain and reverse-proxies to the Node applications.Within the NGINX configuration file I set the domains with their location block like this:server {
listen 443 ssl;
... | now servers require the use of SNI for https connections. Like almost all modern webservers.
You need do addproxy_ssl_server_name on;to your configuration.The smallest location block would be the following:location / {
proxy_set_header host my-app.now.sh;
proxy_ssl_server_name on;
proxy_pass ... |
Nginx+Passenger Error - libcurl.so.4: version `CURL_OPENSSL_3' not found | System:Ubuntu:18.04 LTSPassenger:5.3.1nginxwithlibnginx-mod-http-passenger$ sudo nginx -tReturns:PassengerLoggingAgent: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by PassengerLoggingAgent)
2018/06/04 02:28:40 [alert] 10411#0: Unable to start the Phusion Passenger watchdog becau... | You can install the required version 3 from the bionic repository if you don't depend on other software that already uses version 4:sudo apt install libcurl3/bionicThis will ask you to removecurlitself,libcurl4, and dependend software. Consider carefully if you need those, before removing them.You still can roll back b... |
Nginx case insensitive proxy_pass | I've got a site calledhttp://example.com, with an app running that can be accessed athttp://example.com/app1. The app1 is sitting behind an nginx reverse proxy, like so:location /app1/ {
proxy_pass http://localhost:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header C... | You should capture rest of the url and then use itlocation ~* /app1/(.*) {
proxy_pass http://localhost:8080/$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
} |
How to update my Nginx with yum on CentOS 7 | I usedyum install nginxon my ECS server, but the version is not high enough to support http2. After googling around, I added a config file:/etc/yum.repos.d/nginx.repoWith the content:[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1Then I runyum update ... | Update your config file to this[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=0
enabled=1you need the mainline repository |
Cache-Control Headers not respected on CloudFlare | I am trying to get some html pages to be cached, the same way images are automatically cached via CloudFlare but I can't get CloudFlare to actually hits its cache for html.According to the documentation (Ref:https://support.cloudflare.com/hc/en-us/articles/202775670-How-Do-I-Tell-CloudFlare-What-to-Cache-), it's possib... | It is now possible to get Cloudflare to respect your web servers headers instead of overriding them with the minimum described in the Browser Cache TTL setting.Firstly navigate to the Caching tab in the Cloudflare dashboard:From here you can scroll down to the "Browser Cache Expiration" setting, from here you can selec... |
Luasocket + nginx error - lua entry thread aborted: runtime error: attempt to yield across C-call boundary | When I use the following script:local smtp = require("socket.smtp")
local from = "from@host"
local rcpt = "rcpt@host"
local msg = {
headers = {
to = rcpt,
subject = "Hi"
},
body = "Hello"
}
smtp.send{from = from,rcpt = rcpt,source = smtp.message(msg)}I'm getting an error message:lua entry thread aborted: ... | smtp.senduses LuaSocket'ssocket.protectfunction for handling internal errors. This function is implemented in C and doesn't allow yielding in the current releases (the version in git HEAD now allows yielding on Lua 5.2+, see discussionhere). Apparently someone tries to yield from within it. Inetc/dispatch.luain the Lua... |
getting error while using lua with nginx | I am very new to nginx and lua .i have installed Openresty .
below is my code in nginx.conf file .server{
location /hellolua {
default_type 'text/plain';
content_by_lua ' local name = ngx.var.arg_name or "Anonymous"
ngx.say("Hello, ", name, "!") ';
}
}When i am runni... | It seems to me, as if you haven't installed the right module? ngx_lua (http://wiki.nginx.org/HttpLuaModule)You mention OpenResty. Did you configure it with lua? If not, the guide is here(http://wiki.nginx.org/HttpLuaModule#Installation).Quick resumé:The ngx_openresty bundle can be used to install Nginx, ngx_lua, either... |
Nginx#ngx_http_limit_req_module: For how long is 503 returned once exceeding the rate? | Say I setlimit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
server {
location / {
limit_req zone=one burst=5 nodelay;
}Then for5 seconds, I send10 requestsper second.Which request should see a200and which should see a503?Would it be the first of each 10 requests?Or doesnginxkeep track ofbad use... | As it stated in the documentation:http://nginx.org/en/docs/http/ngx_http_limit_req_module.htmlnginx uses "leaky bucket" algorithm which is simple and pretty common in network area. You can read about it on wikipedia:http://en.wikipedia.org/wiki/Leaky_bucketAs for your question (rate=1r/s burst=5 nodelay), in practice i... |
RabbitMQ managment Nginx proxy | I have loadbalancer and vm with rabbitmq broker. On rabbitmq open 5672 port with plugin managment if I am create proxy to rabbitmq recivecurl: (52) Empty reply from serverI am can connect with telnet to rmq server and have callbackcurl: (56) Recv failure: Connection reset by peerNginx configserver {
listen xxx.x... | Oh, I am mistaken the port for management plugin, it's 15672, not 5672. All goodserver {
listen xxx.xxx.xxx.yy:80;
server_name xxxxxxxxxx
access_log acces.log;
error_log error.log;
location / {
client_body_buffer_size 128k;
proxy_send_timeout 90;
proxy_read_timeout 90;... |
Nginx: Setting a default file extension | What rule would I use for nginx so my default file extension is .php?I currently access a pages using www.mywebsite.com/home.phpbut I want to just use www.mywebsite.com/homeThanks | Assuming you also want to serve static files, you could use something like this:server {
server_name example.com;
# Set the docroot directly in the server
root /var/www;
# Allow index.php or index.html as directory index files
index index.html index.php;
# See if a file or directory was requested first. ... |
Nginx check if Cloudflare forward or direct IP and limit accordingly | I am aware of the headersCF-Connecting-IP,$binary_remote_addr,http_x_forwarded_forI want to make a setting:limit_req_zone $http_x_forwarded_for zone=k_request_limit_per_ip:10m rate=400r/s;
limit_conn_zone $http_x_forwarded_for zone=k_connection_limit_per_ip:10m;But Cloudflare isn't the only place that this machine is g... | You can make use of the ngx_real_ip_module.http://nginx.org/en/docs/http/ngx_http_realip_module.htmlWith this you can specify the Cloudflare CIDRs to be allowed to override thebinary_remote_addrwith the value fromX-Forwarded-For. Make sure you have this check in place. Config could look like:set_real_ip_from 173.245.48... |
Nginx as a reverse proxy behind AWS ALB (self-signed) | I've created an environment in AWS which includes an EC2 instance with node js web-server and Nginx installed, behind a self-signed application load balancer.My ALB gets requests from HTTPS (443) and forwards them on HTTP (80) to the Nginx. My Nginx should get the requests from the ALB (in port 80) and forward them on ... | Worked. The problem was in the "/etc/nginx/nginx.conf" file. After a lot of reading and try - I've found that inside the file it forwards to HTML (instead of my nodejs web server).
Changed the line of "root /path_to_ws", restarted Nginx and it worked.
Thank you for the help! |
Nginx showing 403 forbidden | I have hosted react app on nginx, when i try to access any file with extension (e.g favicon.ico), nginx throws 403 forbidden error although it works fine for basic app routing i.e, for files without extension. I'm pasting nginx config below, and the static files that i'm trying to access is in the /var/www/deebaco.com/... | Check the owner of the public directory, for example using this command:ls -l /var/www/deebaco.com/htmlnginxoften runs asnobody, Instead, it should run with the same user as the owner.Edit/etc/nginx/nginx.confto set the same user. For example, if the directory is owned bywww-data, add the following:user www-data;After... |
How to redirect old react-router HashRouter (with the #) to BrowserRouter? | We're replacingreact-router-domsHashRouterwithBrowserRouterand would like to redirect old routes to the new ones.
I taggednginxbecause I don't mind making redirects there. :)So say we have an old route/#/usersand/#/users:id: They should match and redirect to/usersand/users/:id.So far I tried (react-router-dom v5.0.1):
... | Here's my solution:
} />
Only routes that have/#will match/. One could easily add a conditional if needed to render something on root. |
nginx how to do if not regex | I have as below in nginx but it doesn't do what I intend:location / {
if ($host !~* blah.blah.com) {
return 307 https://$host/$request?uri;
}
}I basically need to do a 307 when $host doesn't match blah.blah.com in regex or it could really just be a plain string. I tried putting them in double quotes or /.../ bu... | As you say, you do not need to use aregular expressionto match a single string. You can use the=and!=operators with theifdirective. Seethis documentfor details.For example:if ($host != foo.example.com) { ... }The correctregular expressionfor the above requires two anchors (^and$) and an escape for the.which would other... |
Nginx with gunicorn with double authorization | I want to use http auth but also, a reverse proxy using gunicorn.For http auth I use:location = admin.html {
auth_basic 'Login Required'
auth_basic__use_file etc/nginx/.htpasswd;
}for gunicorn, proxy reverse I found:try_files $uri @gunicorn;How can I combine both ? | Do you mean you want to use nginx as a reverse proxy server for django with additional level of authorization? You simply move yourauth_basicandauth_basic_user_filedirectives fromlocationblock toserverblock:upstream gunicorn_server {
server unix:;
}
server {
listen ...;
server_name ...;
auth_basic "Log... |
How to configure redirects to url with trailing slash in nginx? | I want to redirect URLs without slash to the path with trailing slash.
So/some-urlto/some-url/And the rest of the URLs, like/some-url.xml/some-url?/some-url?q=v/some-url/Should stay without redirection.I found this articlehttps://www.ateamsystems.com/tech-blog/nginx-add-trailing-slash-with-301-redirect-without-if-state... | This should solve the problem:location / {
if ($request_uri ~ ^([^.\?]*[^/])$) {
return 301 $1/;
}
try_files $uri $uri/ /index.php$is_args$args;
} |
Recommended settings for uwsgi | I have a mysql + django + uwsgi + nginx application and I recently had some issues with uwsgi's default configuration so I want to reconfigure it but I have no idea what the recommended values are.Another problem is that I couldn't find the default settings that uwsgi uses and that makes debugging really hard.Using the... | We run usually quite small applications... Rarely more than 2000 requests per minute. But anyway its is hard to compare different applications. Thats what we use on production:Recommendation by thedocumentationHaharakiri = 20 # respawn processes taking more than 20 seconds
limit-as = 256 # limit the project to 256 MB
m... |
nginx server_name regex | server_name in nginx does not matchI want to match with such FQDNs
I came up withserver_name "~^(www.)?ucwebapi-uccore(\d{0,3})-(\d{0,3})\.testme\.net";To Matchucwebapi.testme.net
ucwebapi-uccore.testme.net
ucwebapi-uccore1-0.testme.net
ucwebapi-uccore999-999.testme.netValidated withhttps://regex101.com/r/tAwEp9/2Teste... | Try this:server_name "~^(www.)?ucwebapi(-uccore)?(\d{1,3}-\d{1,3})?\.testme\.net";It looks like there are some missing characters between your regex101 page and what ended up in your config.I've also tuned it a bit so that it will NOT match:ucwebapi-uccore999.testme.net
ucwebapi-uccore-.testme.net
ucwebapi-uccore-999.t... |
How can I disable nginx gzip from PHP? | I am tyring to stop nginx from gzipping a single PHP request. I already have the following:@ini_set('zlib.output_compression', 'Off');
@ini_set('implicit_flush', 1);
header('X-Accel-Buffering: no');According to everything I have found, thatX-Accel-Bufferingalone should disable gzip, however when I load this pag... | Nginx will not run gzip filter ifContent-Encodingheader is found in the upstream response. So, you can setContent-Encoding: identityheader on the backend, and nginx will pass the response (and header) to the client without gzip process.identitymeans "not encoded". |
Parse nginx ingress logs in fluentd | I'd like to parse ingress nginx logs using fluentd in Kubernetes. That was quite easy in Logstash, but I'm confused regarding fluentd syntax.Right now I have the following rules:
type tail
path /var/log/containers/*.log
pos_file /var/log/es-containers.log.pos
time_format %Y-%m-%dT%H:%M:%S.%NZ
tag kubernetes.*... | Pipelines are quite different in logstash and fluentd. And it took some time to build working Kubernetes -> Fluentd -> Elasticsearch -> Kibana solution.Short answer to my question is to installfluent-plugin-parserplugin (I wonder why it doesn't ship within standard package) and put this rule afterkubernetes_metadatafil... |
Rails/Nginx/Capistrano/Puma: (111: Connection refused) while connecting to upstream | I keep getting this error in the nginx.error.log:2016/06/06 20:14:02 [error] 907#0: *1 connect() to unix:///home/user/apps/appname/shared/tmp/sockets/appname-puma.sock failed (111: Connection refused) while connecting to upstream, client: 50.100.162.19, server: , request: "GET / HTTP/1.1", upstream: "http://unix:///hom... | So the solution was to restart puma.cap production deploy:restartEvery time I reboot the server, I need to restart puma as well. |
Have nginx return a 204 instead of 5xx | I need my nginx front-end to return 204 when the back-end reply a 5xx or timeout.Is it possible?Thanks | Okay, finally I used:location @return_204 {
return 204;
}
location / {
proxy_pass http://zzz;
proxy_intercept_errors on;
error_page 500 502 503 504 = @return_204;
} |
nginx proxy redirection with port from uri | I'm trying to make redirections using nginx. The idea is to redirect uri /id_1234/ to localhost:1234 for some ports. The redirection for the fixed port:location /id_1234/ {
rewrite ^/id_1234/(.*) /$1 break;
proxy_pass http://localhost:1234;
proxy_redirect http://localhost:1234/ $scheme://$host/id_1234/;
}It... | Addingresolver 127.0.0.1;helps, but it's very strange... |
How to host 3 node apps with 3 different domains on one VPS? | I'm stuck trying to setup up several Node apps on different domains on one Digital Ocean droplet. I followed theHost Multiple Node.js Applications On a Single VPS with nginx, forever, and crontabarticle exactly.I have the domains all pointed correctly and A records set.I can't seem to get apps to run (with forever) on ... | See what you have to do is:
Lets say you have 3 node instances running on 3000,5000,7000.
Now you have to point 3 sub domains to same ip lets say ig you have a domain example.com then ex1,ex2,ex3 these three will point to same ip.
Now create 3 seperate files in /etc/nginx/sites-enabled/
lets say ex1.example.com, ex2.ex... |
NGINX not picking up changes in Vagrant Synced folder | I have an Ubuntu VirtualBox that's setup by Vagrant. Its running NGINX to serve some static files and a Django app.I have the source folder synced via vagrant to the repo in my host (windows). I can make changes to a Javascript file in Windows and verify that the changes are made to my file in the VM by SSH'ing in and ... | Apparently my coworker has better Google-foo than I.This is apparently a known issue with virtualbox and nginx that has to do with the nginx's sendfile. You can simply add "sendfile off;" in either your server or location blocks in the nginx config. Here's a blogpost about it:nginx virtualbox static files |
"include_recipe" vs. Vagrantfile "chef.add_recipe". What's the difference? | Just ran nginx::source recipe on my vagrant box, and I have very unusual behaviour.When I include a recipe from theVagrantfile(as below), everything works like a charm,chef.add_recipe("project::nginx")chef.add_recipe("nginx::source")(project::nginxrecipe is very simple. Using it to override default attributes of the ng... | Gotya! Chef 11 feature. Issue with it exist in chef-solo solely :)To make a quick resume, difference is:chef.add_recipe() - loads entire cookbook context (all the files, e.g. recipes, definitions, attributes...)include_recipe "" - files(attributes, definitions etc.) that are not in the expended run list are not loaded.... |
Foreman not working with NGINX | I'm trying to useForeman(version 0.31.0) to manage our application's processes but I'm not having much luck with nginx (nginx/1.0.10 + Phusion Passenger 3.0.11).Here's the relevant line from my Procfile:nginx: sudo /home/ubuntu/nginx/sbin/nginxWhen I start the app, Foreman reports that nginx is started and then immedia... | You'll want to run nginx in foreground mode by adding the following to your nginx.confdaemon off;You can specify a custom nginx.conf to nginx with the -c argument |
Install Subversion on Ubuntu with NGINX, not Apache | I'm using Ubuntu 10.10 and I could like to install Subversion. I don't need http access to the files and I would like to use SSH.
The majority of the examples I've seen on how to install Subversion use Apache. I don't want to install Apache on my sever since I'm using NGINX. Can I just install Subversion without instal... | If you don't need HTTP access to your subversion repository, all you need to do is just install subversion and create a repository like this:svnadmin create /path/to/repositoryThen you can check out local copies directly:svn co /path/to/repository /path/to/my/checkoutOr over ssh:svn co svn+ssh://server/path/to/reposito... |
Capistrano + NGINX Passenger Restart Rails App | I've finally gotten capistrano to work on my website, however, I cannot seem to get the restart part of the application to work. What I want todo is setup capistrano to restart the mongrel cluster that is running the rails app after a deploy has gone through. Since I used passenger to install everything, I have no clue... | I think adding this task to your deploy.rb file should donamespace :deploy do
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
endBasically this will run thetouch tmp/restart.txtin the rails root directory which will restart passenger |
nginx subdomain rewrite | Yet another nginx rewrite rule question:How can I do a rewrite fromhttp://www.*.domain.comtohttp://*.domain.com? | if ($host ~* www\.(.*)) {
set $host_without_www $1;
rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'
}Answer from server fault:https://serverfault.com/questions/139579/nginx-subdomain-rewrite |
send nginx rtmp fragments to WebRTC | I'd like to use OBS to stream via RTMP to a nginx server, and then locally send the RTMP fragments to WebRTC, so that they can be transmitted to the client via a MediaStream. I think this possible as it is essentially describedhere. I'm doing this because the multi-second latency of HLS is not appropriate for what I'... | This is easily possible! You could base it off Pion’srtp-to-webrtcexample. This allows you to easily get media from ffmpeg into the browser.The ffmpeg command you run instead would be like this oneffmpeg -re -i rtmp://localhost:1935/$app/$name -vn -acodec libopus -f rtp rtp://localhost:6000 -vcodec copy -an -f rtp rtp:... |
How to setup laravel file permission once and for all | I have followed this upvotedanswerand did the following:sudo chown -R my-user:www-data /var/www/domain.com/
sudo find /var/www/domain.com/ -type f -exec chmod 664 {} \;
sudo find /var/www/domain.com/ -type d -exec chmod 775 {} \;
sudo chgrp -R www-data /var/www/domain.com/storage /var/www/domain.com/bootstrap/cache
sud... | Option 1 add www-data group to my-user:sudo adduser www-data my-userOption 2 change user of php-fpm into my-user (ref):find options user and group in www.conf, and change it into[my-user] group=mygroup |
Is Nginx open source FIPS compliant? | I am investigating FIPS compliance for our platform. nginx is one of the components and we use nginx 1.15.1. I found the documentation about nginx plus being FIPS compliant.When NGINX Plus is executed on an operating system where a FIPS‑validated OpenSSL cryptographic module is present and FIPS mode is enabled, NGINX P... | According to this blog post, it's not a "No" but more of a "We can't be sure" (emphasis mine):NGINX tests and verifies that NGINX Plus operates correctly when it is run on a FIPS‑enabled OS that is running in FIPS mode.NGINX cannot make similar statements for NGINX Open Source...https://www.nginx.com/blog/achieving-fip... |
nginx proxyPass to prometheus using variable | I have the following nginx.conflocation /monitoring/prometheus/ {
resolver 172.20.0.10 valid=5s;
set $prometheusUrl http://prometheus.monitoring.svc.cluster.local:9090/;
proxy_set_header Accept-Encoding "";
proxy_pass $prometheusUrl;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
p... | I just figured it out.
As stated in thedocsWhen variables are used in proxy_pass:location /name/ {
proxy_pass http://127.0.0.1$request_uri;
}In this case, if URI is specified in the directive, it is passed to the server as is, replacing the original request URI.So the problem was that I specified a request uri in t... |
Is it possible to consolidate multiple responses and send one response in NGINX | I have Nginx/openresty and some other services running on one VM. Basically VM accepts requests on Openresty and then openresty forwards requests to appropriate service. e.g. below requests getting forwarded to ServiceA, ServiceB and ServiceC respectively. It is working fine.http://server:80/services/refAhttp://server:... | you can do it like below. Basically you capture response from other services and then combine themlocation /services/refALL {
content_by_lua_block {
local respA = ngx.location.capture("/services/refA")
local respB = ngx.location.capture("/services/refB")
local respC = ngx.location.capture("/service... |
Accessing NGINX virtual host in local network | I would like to access a virtual host on my dev workstation (Arch Linux) from mobile or tablet connected in the same network.My nginx.conf virtual host spec looks like this:http {include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 16M;
# Domain site1.dev
... | Yourdev workstation's/etc/hostsfile is readed only when you open a browser (or want to reach the network) from yourdev workstation. If you reach the network from your mobile thedev workstation's/etc/hostswill be ignored.If you want to reach192.168.2.11assite1.devfrom your mobile or tablet too you should create an/etc/h... |
Serve static content through subdomain in nginx | I have someslatedocs as website and would like to serve them on the internal server, through a subdomain as follows:internal-docs.mysite.com. For the record, accessingmysite.comshows the "nginx is running propertly" page.I've created a config file with following path and name:/etc/nginx/sites-available/internal-docs.my... | It seems you forgot the Listen directive. Try the following:server {
listen 80;
server_name internal-docs.mysite.com;
root /var/www/docs-internal;
index index.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
... |
How solve"no python application found check your startup logs" error for Django + uWSGI + nginx stack | I user Django 1.10 with uWSGI and nginx on ubuntu 16.04 and deploy my app with ansible. My project have not default structure, but quite common ( thank Two scoopce for this :).
I use split dev and production settings and config folder instead 'name' project folder. It's looks like this:|-- config
| |-- __init__.py
| ... | After several weeks i can find problem in mywsgi.py. It common solution useos.environ['ENV']forDJANGO_SETTINGS_MODULE, but with deffrent users and permissions its dosen't work.If you use in yourwsgi.pyfile something like this:os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings." + os.environ["ENV"]And have problem ... |
Letsencrypt certbot-nginx plugin. How does it work? | I success with using certbot-nginx plugin.I know thatitis opensource and hosted on github.But I do not have enough skill to analyze this code.For example:I have several internal sites which is proxied by nginx. All virtualhost configs has following access restrictions by anonymous:allow 192.168.1.0/24;
allow 192.168.0.... | I was asking the same question myself so I did some digging around and here is what I found out:Certbot mainly uses 80 or 443 ports for challenges (http-01andtls-sni-01) to verify domain ownership as it is described incertbot docs:Under the hood, plugins use one of several ACME protocol challenges to
prove you control ... |
Nginx dynamic location path configuration | Firstly I want to state that I'm rather new to nginx, I basically only know what I've learned over the last week.That said, I currently have a Nginx server with a standard configuration of:server {
listen 80;
server_name site.com;
root /var/www/site.com/;
index index.php;
location / {
try_files $uri $ur... | You probably need to limit the capture to the first two path segments:location ~ ^(/microsite/[^/]+) {
try_files $uri $uri/ $1/;
}The[^/]character class matches anything that is not a/ |
Limit Nginx max concurrent connections | I am looking for a way to limit the number of maximum concurrent connections to 1.
I do not want a connection limit per IP, I already know this is supported.As far as I can see,max_connswould be exactly what I'm looking for, but unfortunately it's not available in the free version:Additionally, the following parameters... | Literally moments after I posted this question, I stumbled uponthiswhile googling for how to whitelist IPs from a file in Nginx! Kind of funny considering I spent the last 2 hours googling for specific terms about rate limiting; talk about relevance, heh..limit_conn_zone $server_name zone=servers:1m;
limit_conn servers... |
NET::ERR_CERT_AUTHORITY_INVALID https in red color | When i try to access my ruby site from android mobile device i get following error, can anyone help me solving this problem.With following added error NET::ERR_CERT_AUTHORITY_INVALID | You need to add intermediate certificate file in your nginx configuration.Hereis the powerfull tool byzakjanto obtain the intermediate certificate files using your main certificate, Store obtained crt file to your server and mentioned it in thenginx.confinssl_certificate |
How to run Nginx with Node.js on Windows? | I want to install Nginx on Windows, and to run two node application. How can I do this?I've tried to download Nginx 1.6.3, but I don't find something relevant about how to run on Windows. Just for Linux. I think there should be some modules for node.Any advice will be useful! | I never run Nginx on Windows, but the official documentation says how:http://nginx.org/en/docs/windows.html.To run two node applications with Nginx, it's necessary to create a proxy. This is an example of how to alter thenginx.conffile for this:worker_processes 1;
events {
worker_connections 1024;
}
http {
... |
How to configure Nginx to try two upstreams before 404ing? | Given an Nginx configuration roughly like this:upstream A {
server aa:8080;
}
upstream B {
server bb:8080;
}
server {
listen 80;
location @backendA {
proxy_pass http://A/;
}
location @backendB {
proxy_pass http://B/;
}
location / {
# This doesn't work. :)
try_files @backendA @ba... | After further googling, I came uponthis solution:location / {
# Send 404s to B
error_page 404 = @backendB;
proxy_intercept_errors on;
log_not_found off;
# Try the proxy like normal
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $... |
nginx critical error with SSL handshaking | I have problem with my nginx on Ubuntu 14.04 LTS. From time to time I get a critical error:2015/01/18 12:59:44 [crit] 1065#0: *28289 SSL_do_handshake() failed (SSL: error:140A1175:SSL routines:SSL_BYTES_TO_CIPHER_LIST:inappropriate fallback) while SSL handshaking, client: 10.0.2.2, server: 0.0.0.0:443I've checked versi... | ...BYTES_TO_CIPHER_LIST:inappropriate fallback) while SSL handshaking, client: 10.0.2.2, server: 0.0.0.0:443This looks like someone checking if the server supports TLS_FALLBACK_SCSV, which it does in your case. Nothing to worry about. On the contrary this means that your server supports a useful security feature. For m... |
nginx: how limit_req_zone zone gets cleared? | According to nginx documentation onlimit_req_zoneOne megabyte zone can keep about 16 thousand 64-byte states. If the zone storage is exhausted, the server will return the 503 (Service Temporarily Unavailable) error to all further requests.I wonder in what way these zones get cleared? For example if we have smth likelim... | It should be checked, but as I understood lifetime of the zone items relates to the active connections.Sozone=one:1mcan hold up to16 K unique IPsamong currently (simultaneously)active connections(total number of the active connections at the moment can exceed 16 K, because a few connections can be opened from the same ... |
Dynamic proxy_pass with map and regexp | I'm trying to get the following pattern to work. I need to specify a dynamic path in my client side code to be able to switch to a few predefined hosts. I map these hosts by appending their alias to a /fwd/ url. The alias is mapped to the real server in nginx like this:map $uri $repoUrl {
default invali... | I eventually went back to the first approach, because it's not convenient to add a query parameter to a url for this. It makes the client logic unnecessary complex.I found the solution to my first approach. The regex in the location statement was wrong. You need to capture the regex in variable names by using ? like th... |
nginx variable for path of config file | Is there a way to specify, for example, that therootshould be relative to the directory where the config file is living? Something likeroot $conf_path/www | In general, I don't believe this is possible. But, you might be able to hack something together based onthis article.Quoting relevant parts:2ed version is here:How to reference OS Environment Variables in nginx.confPosted at Nginx Forum:http://forum.nginx.org/read.php?2,215269,215278#msg-215278and furtherYou can read ... |
Nginx merge_slashes redirect | I am using nginx in with my Java Application and my problem is that nginx is merging the slashes and I am unable to redirect my website to the correct version.For instance:http://goout.cz/cs/koncerty///praha/is merged tohttp://goout.cz/cs/koncerty/praha/and then I am unable to recognized the malformed URL and perform t... | Try this (untested):merge_slashes off;
rewrite (.*)//+(.*) $1/$2 permanent;It might cause multiple redirects if there are multiple groups of slashes though.Like this:http://goout.cz/////cs/koncerty///praha/Might go to:http://goout.cz/cs/koncerty///praha/Then finally:http://goout.cz/cs/koncerty/praha/ |
Error When Restarting Thin for my Ruby on Rails Application | I am trying to use the folling command to restart thin.thin restart -c config/thin.ymlHere's the content of thin.yml:rackup: /root/SEHabitat/config.ru
pid: /tmp/pids/thin.pid
wait: 30
timeout: 600
log: /root/SEHabitat/log/thin.log
max_conns: 1024
require: []
max_persistent_conns: 512
environment: production
servers: 3... | Option "-c" is to change dir, you have to use upercase "-C" to specify config file. LIkethin config -C /etc/thin/myapp.yml -c /var/ |
nginx reverse proxy cookie forwarding | i have 3 heroku appsfrontendreactbackendnodereverse-proxynginxcalls to reverse-proxy/api/?(.*) are frowarded to backendrest all calls to reverse-proxy are forwarded to frontendthe/etc/nginx/conf.d/default.confcodeupstream frontend {
server $FRONTEND_URL;
}
upstream backend {
server $BACKEND_URL;
}
server {
... | You need addproxy_set_header Cookie $http_cookie;in location config.
Variable $http_cookie is user request cookie. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.