Questions tagged [nginx]

Nginx is a web and proxy server. Note that questions on the use and configuration of server software may be off-topic and subject to closure if they do not directly involve a programming context. Other Stack Exchange sites such as Super User, Server Fault, or Webmasters may be more appropriate places to ask such questions.

Nginx ("engine x") is a lightweight and high-performance HTTP , and , released under a BSD-like license.

From the nginx wiki:

Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Igor Sysoev started development of Nginx in 2002, with the first public release in 2004. Nginx now hosts nearly 12.18% (22.2M) of active sites across all domains. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

Resources:

Useful Links

Talks

Tengine

54687 questions
262
votes
5 answers

How can I have same rule for two locations in NGINX config?

How can I have same rule for two locations in NGINX config? I have tried the following server { location /first/location/ | /second/location/ { .. .. } } but nginx reload threw this error: nginx: [emerg] invalid number of arguments in…
nothing_authentic
  • 2,927
  • 3
  • 17
  • 22
258
votes
16 answers

nginx - client_max_body_size has no effect

nginx keeps saying client intended to send too large body. Googling and RTM pointed me to client_max_body_size. I set it to 200m in the nginx.conf as well as in the vhost conf, restarted Nginx a couple of times but I'm still getting the error…
q_no
  • 2,589
  • 2
  • 15
  • 3
248
votes
3 answers

nginx missing sites-available directory

I installed Nginx on Centos 6 and I am trying to set up virtual hosts. The problem I am having is that I can't seem to find the /etc/nginx/sites-available directory. Is there something I need to do in order to create it? I know Nginx is up and…
Fr0ntSight
  • 2,696
  • 3
  • 17
  • 14
242
votes
3 answers

What does upstream mean in nginx?

upstream app_front_static { server 192.168.206.105:80; } Never seen it before, anyone knows, what it means?
gdb
  • 7,189
  • 12
  • 38
  • 36
230
votes
4 answers

What's the difference of $host and $http_host in Nginx

In Nginx, what's the difference between variables $host and $http_host.
glarrain
  • 8,031
  • 7
  • 31
  • 44
228
votes
11 answers

Nginx 403 forbidden for all files

I have nginx installed with PHP-FPM on a CentOS 5 box, but am struggling to get it to serve any of my files - whether PHP or not. Nginx is running as www-data:www-data, and the default "Welcome to nginx on EPEL" site (owned by root:root with 644…
Angus Ireland
  • 2,385
  • 3
  • 22
  • 21
226
votes
8 answers

Have nginx access_log and error_log log to STDOUT and STDERR of master process

Is there a way to have the master process log to STDOUT STDERR instead of to a file? It seems that you can only pass a filepath to the access_log directive: access_log /var/log/nginx/access.log And the same goes for error_log: error_log…
quinn
  • 5,508
  • 10
  • 34
  • 54
225
votes
17 answers

NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream

I have Puma running as the upstream app server and Riak as my background db cluster. When I send a request that map-reduces a chunk of data for about 25K users and returns it from Riak to the app, I get an error in the Nginx log: upstream timed out…
user2768537
  • 2,251
  • 2
  • 12
  • 4
221
votes
16 answers

Possible reason for NGINX 499 error codes

I'm getting a lot of 499 NGINX error codes. I see that this is a client side issue. It is not a problem with NGINX or my uWSGI stack. I note the correlation in uWSGI logs when a get a 499. address space usage: 383692800 bytes/365MB} {rss usage:…
Tampa
  • 75,446
  • 119
  • 278
  • 425
214
votes
5 answers

How do I prevent a Gateway Timeout with FastCGI on Nginx

I am running Django, FastCGI, and Nginx. I am creating an api of sorts that where someone can send some data via XML which I will process and then return some status codes for each node that was sent over. The problem is that Nginx will throw a 504…
sheats
  • 33,062
  • 15
  • 45
  • 44
212
votes
6 answers

nginx: [emerg] "server" directive is not allowed here

I have reconfigured nginx but I can't get it to restart using the following configuration: server { listen 80; server_name www.example.com; return 301 $scheme://example.com$request_uri; } server { listen 80; server_name…
samix73
  • 2,802
  • 4
  • 17
  • 29
212
votes
11 answers

Nginx reverse proxy causing 504 Gateway Timeout

I am using Nginx as a reverse proxy that takes requests then does a proxy_pass to get the actual web application from the upstream server running on port 8001. If I go to mywebsite.example or do a wget, I get a 504 Gateway Timeout after 60…
Dave Roma
  • 2,449
  • 3
  • 18
  • 13
210
votes
28 answers

Nginx serves .php files as downloads, instead of executing them

I am installing a website in a droplet (Digital Ocean). I have an issue for install NGINX with PHP properly. I did a tutorial https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04 but when I…
Apeiron
  • 1,881
  • 2
  • 13
  • 21
207
votes
8 answers

How to redirect to a different domain using Nginx?

How can I redirect mydomain.example and any subdomain *.mydomain.example to www.adifferentdomain.example using Nginx?
deb
  • 12,326
  • 21
  • 67
  • 86
207
votes
16 answers

React-router and nginx

I am transitioning my react app from webpack-dev-server to nginx. When I go to the root url "localhost:8080/login" I simply get a 404 and in my nginx log I see that it is trying to get: my-nginx-container | 2017/05/12 21:07:01 [error] 6#6: *11…
martin
  • 3,289
  • 5
  • 22
  • 27