nginx (pronounced "engine-x") is a lightweight, high-performance Web server and reverse proxy as well as IMAP/POP3 proxy server.

learn more… | top users | synonyms

12
votes
2answers
563 views

Is there an elegant way to block a bunch of referrers at once?

In order to prevent referrer spam, my nginx.conf contains a section like this: if ($http_referer ~* spamdomain1\.com) { return 444; } if ($http_referer ~* spamdomain2\.com) { return 444; } if ...
12
votes
3answers
14k views

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: ...
12
votes
4answers
7k views

Nginx Varnish Nginx Django?

I have a django app and I want to to setup Varnish on a server in front of it. In another serverfault thread somebody suggested putting Nginx in front of Varnish. Should I put Nginx in front of ...
12
votes
2answers
21k views

Nginx Redirect via Proxy, Rewrite and Preserve URL

In Nginx we have been trying to redirect a URL as follows: http://example.com/some/path -> http://192.168.1.24 where the user still sees the original URL in their browser. Once the user is ...
12
votes
4answers
1k views

What does Nginx lack that Apache has?

Nginx is said to be much more resource-efficient and easier to configure than Apache. A friend told me that "it can't do some things that Apache can do, but I don't need those things anyway." Still, ...
12
votes
3answers
1k views

The downsides of using nginx as a primary web server?

I've seen millions of websites using nginx as a proxifying webserver working together with Apache. But I've seen very few servers running nginx only as their default webserver. What are the main ...
12
votes
5answers
16k views

Why are my PHP files downloading instead of processing with Nginx

I have seen the same problem, and many resolutions for it pointing to adding the type handler, but that was for Apache. I am using Arch Linux, Nginx, PHP and PHP-FMP and I cannot figure out why php ...
12
votes
3answers
2k views

Determining a realistic measure of requests per second for a web server

I'm setting up a nginx stack and optimizing the configuration before going live. Running ab to stress test the machine, I was disappointed to see things topping out at 150 requests per second with a ...
12
votes
3answers
2k views

How to write a DRY, modular nginx conf (reverse proxy) with named locations

I'm using nginx mostly as a reverse cachining proxy in front of several gunicon/mod_wsgi applications and of course to server static files. I find that quickly my nginx confs become impossible to ...
11
votes
3answers
5k views

Reply with 200 from Nginx config without serving a file

I have configured Apache to send back a 200 response without serving any file with this configuration line Redirect 200 /hello Can I do this with Nginx? I don't want to serve a file, I just want ...
11
votes
3answers
12k views

How to stop nginx on Mac OS X

I've installed and configured nginx server on my Mac from MacPorts sudo port install nginx Followed the recommendation from the port installation console and created the launchd startup item for ...
11
votes
2answers
9k views

Nginx - Serve static content from a cookieless domain

I'm using the "page speed" extension for Firebug to try to optimise a website and I'm currently working on the following suggestion: "Serve static content from a cookieless domain". I have created a ...
11
votes
2answers
7k views

best way to debug nginx config file?

I have a bunch of rewrite rules that I have to port from apache to nginx. It's a rather painful process because I'm not able to see if my rewrite rules and "if" conditions are working as I want them ...
11
votes
4answers
37k views

Nginx 1 FastCGI sent in stderr: “Primary script unknown”

My first time using Nginx, but I am more than familiar with Apache and Linux. I am using an existing project and when ever I am trying to see the index.php I get a 404 File not found. Here is the ...
11
votes
2answers
441 views

Why is 14 characters the maximum length for the nginx server_name directive?

I have the following virtual host server { server_name abc.example.com; root /var/www/test/; index index.html; } When running nginx -s reload I get the following error: nginx: [emerg] ...
11
votes
2answers
3k views

How can I configure nginx locations to share common configuration options?

How can i configure a shared config block for a set of locations? location / { proxy_pass http://127.0.0.1:9000/; proxy_redirect off; ...
11
votes
3answers
4k views

Alternatives to apache benchmark? [on hold]

I'd like some tools for ubuntu that I can use to test my server, how much it can handle. Any suggestions? I've used apache benchmark before, but I'd like to try out something else. (As a side ...
11
votes
1answer
5k views

nginx: [emerg] unknown directive “http”

When I try to make code like it: 1. http { 2. script 3. server { 4. ... 5. location ... 6. } 7. } I get error: nginx: [emerg] unknown directive "http" in ...
11
votes
2answers
7k views

nginx url rewriting: difference between break and last

I don't understand the difference between break and last (flags of rewrite). The documentation is rather abstruse. I've tried to switch between the two in some of my configs, but I couldn't spot any ...
11
votes
1answer
29k views

What is the name and location of the Nginx config file (htaccess equivalent)?

There are many tutorials on how to write Nginx rewrite rules to mimic Apache's .htaccess file but I can't confidently say I know what the name or location of this so-called Nginx config file actually ...
11
votes
1answer
991 views

Why do I need nginx when I have uWSGI

There are many tutorials on how to configure nginx to cooperate with uWGSI when I want to deploy Django application. But why do I need nginx in this kit? uWSGI itself can serve WSGI Python ...
11
votes
4answers
4k views

SSL Handshake negotiation on Nginx terribly slow

I am using Nginx as a proxy to 4 apache instances. My problem is that SSL negotiation takes a lot of time (600 ms). See this as an example: http://www.webpagetest.org/result/101020_8JXS/1/details/ ...
11
votes
1answer
10k views

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 ...
10
votes
2answers
17k views

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 ...
10
votes
6answers
5k views

What purpose does an empty gif (1x1 pix) file serve?

I've seen a few random pages mention using empty gif images to somehow increase performance. I've also found the nginx has a module for just this purpose. What I can't figure out, is exactly how ...
10
votes
3answers
8k views

nginx: bind() to 0.0.0.0:80 failed on Windows [closed]

I've been using nginx without any problem on windows for the last few months. Today when I tried to start it up, I got this error: nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was ...
10
votes
3answers
13k views

How to set a favicon.ico for a specific Virtual Host on Nginx?

I am using Nginx as my webserver for the first time. I didn't have any trouble to set it up and everything works great. The problem came when the designer asked me if he could send me "the icon in the ...
10
votes
3answers
12k views

How to use nginx to proxy to a host requiring authentication?

How can I setup an nginx proxy_pass directive that will also include HTTP Basic authentication information sent to the proxy host? This is an example of the URL I need to proxy to: ...
10
votes
4answers
17k views

nginx + PHP-FPM = “permission denied” error 13 in nginx log; configuration mistake?

I've got nginx 0.7x + PHP-FPM running under PHP 5.2.10 on one RHEL5 server, but trying to duplicate that setup under the bundled-in PHP-FPM in PHP 5.3.3 on a second server, I'm having some trouble ...
10
votes
3answers
3k views

When should I switch to NGinx?

I have a server with several domains and applications running, all through Apache. All is well at the moment but I have plans to develop some very performance-intensive web application (using C++ with ...
10
votes
3answers
18k views

How can I make nginx support @font-face formats and allow access-control-allow-origin?

I've added these rules to mime.types: application/x-font-ttf ttf; font/opentype otf; application/vnd.ms-fontobject eot; font/x-woff ...
10
votes
4answers
18k views

Nginx + php5-fpm = “File not found”

I've hit a wall whilst setting up a site using nginx / fpm. The page displays "File not found", and this appears in the nginx error.log: FastCGI sent in stderr: "Primary script unknown" while reading ...
10
votes
2answers
5k views

Nginx: force SSL on one path, non-SSL on others

How do I set up Nginx conf file to force SSL on only one of the paths in my site and non-SSL on all the rest? For example, I want all of the URLs under /user to be https but all the rest of the URLs ...
10
votes
1answer
7k views

The strange case of Mr. Time To First Byte

I've got a webserver on a Linode 1024 VPS based on Ubuntu 11.10 Nginx 1.0.5 PHP 5.3.6 (with PHP-FPM, APC) Varnish 3.0.2 And a couple of blogs there based on WordPress 3.3.1. One of them is a ...
10
votes
4answers
13k views

Does Nginx support LDAP authentication?

Hey Does nginx support ldap authentication? I have just migrated from apache and would like to move all of my authentications which are based on openldap and mod_auth_ldap to nginx. Let me know if ...
10
votes
3answers
10k views

Enabling nginx Chunked Transfer Encoding

It looks like nginx 0.8.35 may support chunked transfer encoding: Changes with nginx 0.8.35 01 Apr 2010 *) Change: now the charset filter runs before the ...
10
votes
3answers
4k views

What is the different usages for sites-available vs the conf.d directory for nginx

I have some experience using linux but none using nginx. I have been tasked with researching load-balancing options for an application server. I have used apt-get to install nginx and all seems ...
10
votes
3answers
12k views

How to rewrite the domain part of Set-Cookie in a nginx reverse proxy?

I have a simple nginx reverse proxy: server { server_name external.domain.com; location / { proxy_pass http://backend.int/; } } The problem is that Set-Cookie response headers contain ...
10
votes
1answer
589 views

Passing SSL protocol info to backend via HTTP header

After Poodle vulnerability was revealed recently, our team decided to move on from SSLv3. But before complete removal, they want to warn the daily users that their browser use deprecated SSLv3. So, we ...
10
votes
5answers
8k views

Proper way to rotate Nginx logs

I would like to achieve rotation of nginx logs that: would work without any extra software (i.e. - best if without "logrotate") would create rotated files with names based on date Best approach is ...
10
votes
2answers
10k views

User per virtual host in Nginx

Is it possible in nginx configure different user per virtual host? Something like server { user myprojectuser myprojectgroup; ... }
10
votes
2answers
12k views

Tips for maximizing Nginx requests/sec?

I'm building an analytics package, and project requirements state that I need to support 1 billion hits per day. Yep, "billion". In other words, no less than 12,000 hits per second sustained, and ...
10
votes
2answers
6k views

ApacheBenchmark ab - SSL read failed - closing connection

When I am running ab on my website I get a ton of these responses: SSL read failed - closing connection SSL read failed - closing connection SSL read failed - closing connection And some times it ...
10
votes
5answers
14k views

NGINX timeout after +200 concurrent connections

This is my nginx.conf (I've updated config to make sure that there is no PHP involved or any other bottlenecks): user nginx; worker_processes 4; worker_rlimit_nofile 10240; pid ...
9
votes
3answers
25k views

Nginx enable site command

We all know how to enable a website using apache on linux. I'm pretty sure that we all agree on using the a2ensite command. Unfortunately there is no default equivalent command comes with Nginx, but ...
9
votes
6answers
1k views

How to upgrade software installed from source?

I install NGinx from source since the packages from the ubuntu repository are quite old. I was wondering what is the best method to upgrade these types of installations? My current workflow involves. ...
9
votes
3answers
6k views

Limit upload file size and redirect user to error page if limit exceeds

Is it possible to redirect user to file file too big page when POST request size exceeds specified limit? I am aware about max-request-size option, but it gives just static page that cannot be ...
9
votes
5answers
8k views

How to get nginx to redirect from www to non-www domain?

Let's say I want to redirect from www.example.com to example.com and I want to do this using nginx. I looked around and did not see any good documentation on this so I figured I would ask and answer ...
9
votes
2answers
3k views

Logrotate: how to access the output file in postrotate

I rotate Nginx logs daily (with dateext). After the rotation I want to parse the file for the day that just passed and compile an email with the number of errors returned by Nginx server. How can I ...
9
votes
2answers
5k views

“Hide” .html file extensions using nginx rewrites

I'm serving up a static site via nginx, and my goal is to replace URL's that look like: http://foo.com/bar.html with http://foo.com/bar The key being no trailing slash. I am currently doing ...