Questions tagged [nginx]

Nginx ("eNgine x") is a lightweight, high-performance HTTP server, reverse proxy, TCP stream proxy and mail proxy, released under a BSD-like license.

Nginx is a web server and mail proxy known for its high performance and small resource footprint. It is used in many places as a replacement to Apache and also as a front end server to static content or reverse proxying. Nginx is developed under a BSD-like license by Kazakhstani developer Igor Sysoev.

Nginx comes with diverse modules that enable it to perform various different tasks such as load balancing, URL rewriting, request rate limiting, content compression, raw TCP proxying and integration with tools like memcached or scripting languages like Lua.

Nginx is being used by some of the worlds busiest sites like WordPress, Sourceforge, Github and Reddit. Its market share has been raising from 7% in 2008 to over 30% as of June 2016 according to W3techs statistics.

After nine years of development, Nginx 1.0 stable was released on April 2011.

17216 questions
252
votes
4 answers

How can I see which flags Nginx was compiled with?

How can I check what modules have been added to an nginx installation?
Nisanio
  • 2,683
220
votes
7 answers

Nginx config reload without downtime

I use nginx as a reverse proxy. Whenever I update the config for it using sudo "cp -r #{nginx_config_path}* /etc/nginx/sites-enabled/" sudo "kill -s HUP `cat /var/run/nginx.pid`" I face a brief downtime. How can I avoid that?
Saurav Shah
  • 2,315
158
votes
5 answers

How to output variable in nginx log for debugging

I am testing nginx and want to output variables to the log files. How can I do that and which log file will it go (access or error).
lulalala
  • 1,727
132
votes
4 answers

Nginx: How do I forward an HTTP request to another port?

What I want to do is: When someone visits http://localhost/route/abc the server responds exactly the same as http://localhost:9000/abc Now I configure my Nginx server like this: location /route { proxy_pass http://127.0.0.1:9000; } The HTTP…
WoooHaaaa
  • 1,685
121
votes
2 answers

How does try_files work?

I looked at the nginx documentation and it still confuses me utterly. How does try_files work? Here is what the documentation says: From NginxHttpCoreModule try_files syntax: try_files path1 [path2] uri default: none context: server,…
user274
117
votes
3 answers

nginx - client request body is buffered to a temporary file

I get the following error in my log files every time I try to upload a large file. a client request body is buffered to a temporary file /var/lib/nginx/body/0000000001 Although the file uploads successfully, I always get the above error. I…
Abs
  • 1,609
113
votes
8 answers

What does this nginx error "rewrite or internal redirection cycle" mean?

tail -f /var/log/nginx/error.log 2013/05/04 23:43:35 [error] 733#0: *3662 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: _, request: "GET /robots.txt HTTP/1.1", host:…
pavs-maha
  • 1,133
101
votes
4 answers

"413 Request Entity Too Large" in Nginx with "client_max_body_size" set

I am uploading a 26Gb file, but I am getting: 413 Request Entity Too Large I know, this is related to client_max_body_size, so I have this parameter set to 30000M. location /supercap { root /media/ss/synology_office/server_Seq-Cap/; index…
user2979409
  • 1,111
100
votes
5 answers

How to make a modification take affect without restarting nginx?

Apache has a graceful option which can scan for modification in http.conf without restarting Apache. What about nginx?
vps
  • 1,237
98
votes
1 answer

Nested Nginx location (prefix blocks in regex blocks) not working

I'm having trouble understanding nested locations in nginx. I have two locations with some configuration directives in common, so rather than repeat the directives, I'd prefer to repeat the URI using a regular-expression: location ~ /a|/b { …
Jayen
  • 1,877
  • 4
  • 16
  • 28
91
votes
4 answers

Nginx - root versus alias, for serving single files?

After many hours getting nginx to serve single files such as robots.txt (hint: clear your browser cache each time), I wound up with two different ways, one using the alias directive, and one using the root directive, like so: location /robots.txt {…
Cyclops
  • 1,189
  • 2
  • 9
  • 13
86
votes
1 answer

What’s the difference between the “mainline” and “stable” branches of nginx?

There seem to be two active branches of the nginx web server: a “mainline” branch (currently 1.9.x) and a “stable” branch (currently 1.8.x). Can anyone provide an official source that describes the difference between these two branches and how one…
bdesham
  • 1,785
82
votes
5 answers

Dump nginx config from running process?

Apparently, I shouldn't have spent sleepless night trying to debug an application. I wanted to restart my nginx and discovered that its config file is empty. I don't remember truncating it, but fat fingers and reduced attention probably played their…
80
votes
11 answers

How can I create a location in nginx that works with AND without a trailing slash?

Right now I have this config: location ~ ^/phpmyadmin/(.*)$ { alias /home/phpmyadmin/$1; } However, if I visit www.mysite.com/phpmyadmin (note the lack of trailing slash), it won't find what I'm looking for a 404. I assume because I don't…
Rob
  • 2,453
74
votes
3 answers

nginx: Log complete request / response with all headers?

We have an application server that sometimes hangs. We suspect it is due to a bad request from a client. Can nginx log the complete request/response (like fiddler captures) to files, so we can see the requests that were sent before the hang? (We…
1
2 3
99 100