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

0
votes
2answers
629 views

Is it possible to filter/edit web content using Apache/Nginx/Lighttpd?

Is it possible to use any of the following HTTP servers: Apache, Nginx or Lighttpd as a proxy to make the following: Disallow certain HTTP bodies (web pages) based on their content (e. g., words) ...
0
votes
1answer
268 views

Serving a page whose URL ends in a slash with nginx

I want to make nginx serve an HTML file for /foobar/. I tried 2 configurations and neither worked. In Apache you do it like this: AliasMatch ^/foobar/$ /home/admin/foobar/foobar.html My first ...
0
votes
1answer
174 views

Nginx vhost configuration questions

I have a NginX vhost, where all static content is served by nginx and anything that's not found or ends with php proxies to apache. Just wanted to check if I have locations right: location / { ...
0
votes
1answer
879 views

Apache to Nginx rewrite rules conversion tool

Converting the rewrite rules from Apache to Nginx does not seem to be that difficult However, I'd like to automate the job, as we are planning to migrate a number of sites. Is there any existing ...
-1
votes
2answers
3k views

Unable to allocate memory for pool, How to fix it

I am hosting a number of websites on my Debian server running on NginX, all of my website's log files shows me an error like this 2011/11/23 10:01:03 [error] 5320#0: *349 FastCGI sent in stderr: ...
95
votes
2answers
35k views

How can I see which flags Nginx was compiled with?

How can I check what modules have been added to an nginx installation?
50
votes
1answer
49k views

How do I add Access-Control-Allow-Origin in NGINX?

How do I set the Access-Control-Allow-Origin header so I can use web-fonts from my subdomain on my main domain? Notes: You'll find examples of this and other headers for most HTTP servers in the ...
31
votes
5answers
39k views

Setting expires headers for static content served from nginx

I'm using nginx to server my static content, is there a way that I can set the expires headers for every file that meets a specific rule? For example can I set the expires header for all files that ...
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 ...
8
votes
3answers
17k views

nginx automatic failover load balancing

I'm using nginx and NginxHttpUpstreamModule for loadbalancing. My config is very simple: upstream lb { server 127.0.0.1:8081; server 127.0.0.1:8082; } server { listen 89; ...
18
votes
4answers
18k views

Which is best for Django? Lighttpd or Nginx? Or maybe something else? [closed]

Which of Lighttpd and Nginx is, basing on your experience, better suited for Django? I've used both and can hardly notice any difference at all, they just work fine... Are there any use cases when one ...
8
votes
7answers
6k views

Varnish -> Nginx -> Apache a good idea?

I'm thinking about the architecture for a new Webserver. Would having Varnish as a cache in front of Nginx as a reverse-proxy and serving static files in front of apache for all heavy lifting be a ...
23
votes
1answer
8k views

nginx name-based virtual hosts on IPv6

I have an nginx server serving up nearly half a dozen different websites. It's running on a Linode that just got IPv6 native support (Dallas data center), and I'm trying to configure most of my sites ...
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 ...
5
votes
3answers
1k views

Can you rely on Nginx as your only webserver for php/mysql

Can you rely on Nginx to be your only webserver. I know in terms of performance it works well, but how does it do in terms of security. I know Apache is stable and has ModSecurity. This is not the ...
13
votes
2answers
8k views

Do HTTP reverse proxies typically enable HTTP Keep-Alive on the client side of the proxied connection and not on the server side?

HAProxy has the ability to enable HTTP keep-alive on the client side (client <-> HAProxy) but disable it on the server side (HAProxy <-> server). Some of our clients connect to our web service ...
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 ...
4
votes
2answers
5k views

How to Create Jailed Users?

My servers run CentOS: Nginx + PHP-FPM (PHP via Fast-CGI). Every site is on its own VirtualHost. Currently both Nginx and PHP-FPM run under root. I know this is bad practice, and there is no reason ...
10
votes
2answers
11k 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
3answers
13k 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: ...
9
votes
1answer
13k views

Configure Nginx as reverse proxy with upstream SSL

I try to configure an Nginx server as a reverse proxy so the https requests it receives from clients are forwarded to the upstream server via https as well. Here's the configuration that I use: http ...
7
votes
6answers
2k views

why no examples of horizontally scalable software load balancers balancing ssl?

I have a bunch of questions with respect to ssl, local sessions, and load balancing which seem to be interconnected, so I apologize in advance for the length of this question. I have a website which ...
14
votes
3answers
762 views

Does this prove a network bandwidth bottleneck?

I've incorrectly assumed that my internal AB testing means my server can handle 1k concurrency @3k hits per second. My theory at at the moment is that the network is the bottleneck. The server can't ...
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 ...
9
votes
3answers
34k views

nginx fastcgi “Primary script unknown” when configuring userdir

I hate configuring nginx. It's so complicated. How do I get PHP to work in my user dirs? Here's the relevant part of my nginx.conf: location ~ ^/~(.+?)(/.*)?$ { autoindex on; ...
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 ...
8
votes
2answers
3k views

nginx case insensitive rewrite

I am trying to make my nginx redirects as clean as possible. I understand ~* is for case insensitive but I can only get it to work in example 2. Example 1 rewrite ^/foobar ...
8
votes
1answer
2k views

Poor load balancer performance on rackspace and centos

I am load testing different options for load balancing, and am getting poor results from Nginx, haproxy, and varnish. I have one 4GB load balancer at Rackspace, hitting 4x1GB app servers. I'm ...
8
votes
4answers
6k views

What are the Differences between HAProxy and Ngnix in reverse proxy mode?

What are the differences between HAProxy and Nginx when it comes to their abilities as a reverse proxy?
7
votes
1answer
530 views

How do I verify site ownership on Google Webmaster Tools through nginx.conf?

Since a couple of years ago, Google Webmaster Tools site ownership verification process started to require that verification files have certain content, instead of simply being there and returning 200 ...
7
votes
2answers
3k views

How to rate-limit in nginx, but including/excluding certain IP addresses?

I'm able to use limit_req to rate-limit all requests to my server. However I'd like to remove the rate restriction for certain IP addresses (i.e. whitelist) and use a different rate restriction for ...
7
votes
5answers
3k views

Nginx + Apache trailing slash redirect

I have a Nginx server running on 80 port working as a proxy to Apache 2.2 which is listening to 127.0.0.1:8080 When I access http://hostname/subfolder/ it works great. When I access ...
6
votes
2answers
6k views

why do nginx process run with user nobody

I was trying to setup nginx to run with one of my rails apps, when having a look at output for ps -e | grep nginx , I realised nginx worker processes run with user nobody. Is there a reason why they ...
6
votes
2answers
3k views

How To limit Nginx Auth_Basic re-tries?

I have protected a web folder with Nginx's Auth_Basic module. The problem is, we can try several passwords until it works (brute force attacks). Is there a way to limit the number of failed re-tries?
5
votes
1answer
6k views

Blank Page: wordpress on nginx+php-fpm

Good day. While this post discusses a similar setup to mine serving blank pages occasionally after having made a successful installation, I am unable to serve anything but blank pages. There are no ...
3
votes
1answer
2k views

uwsgi_params not in nginx

Firstly I setup nginx and uwsgi via apt-get. And,I add the line to nginx conf file(/etc/nginx/conf.d/default.conf) like below line; server { listen 80; server_name <replace with your ...
3
votes
2answers
1k views

Cheap way to detect client round trip times for http

I am trying to figure out a way to detect round trip times for each IP that connects to port 80 on my server. What is a good way to do this? There are far to many connections, and pinging each ip is ...
2
votes
1answer
2k views

nginx reverse proxy slows down my throughput by half

I'm currently using nginx to proxy back to gunicorn with 8 workers. I'm using an amazon extra large instance with 4 virtual cores. When I connect to gunicorn directly I get about 10K requests/sec. ...
16
votes
1answer
24k views

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 document says From NginxHttpCoreModule try_files syntax: try_files path1 ...
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 ...
9
votes
4answers
4k views

Remove “www” and redirect to “https” with nginx

I want to create a rule in nginx that does two things: Removes the "www." from the request URI Redirects to "https" if the request URI is "http" There are plenty of examples of how to do each of ...
8
votes
3answers
7k views

Make nginx to pass hostname of the upstream when reverseproxying

I run several docker containers with hostnames: web1.local web2.local web3.local Routing to these done based on hostname by nginx. I have a proxy in front of this setup (on different machine ...
6
votes
6answers
4k views

PHP-CGI Started Serving Blank Pages

My PHP-CGI started serving blank pages for no apparent reason until I restarted the process. I want to know why. Unfortunately the "production" configuration file of PHP has no error_log by default. ...
5
votes
1answer
1k views

add_header directives in location overwriting add_header directives in server

Using nginx 1.2.1 I am able to add multiple headers using add_header as follows: server { listen 80; server_name localhost; root /var/www; add_header Name1 Value1; <=== ...
5
votes
2answers
5k views

“ImportError: No module named flask” - Trouble with nginx + uWSGI + Flask in a virtualenv setup

I got nginx + uWSGI running on localhost inside a virtualenv with a simple hello world program, but I get this error when I replace the hello world with a simple Flask app: File ...
5
votes
1answer
5k views

Nginx + PHP-FPM = “Random” 502 Bad Gateway

I am running Nginx and proxying php requests via FastCGI to PHP-FPM for processing. I will randomly receive 502 Bad Gateway error pages - I can reproduce this issue by clicking around my PHP websites ...
4
votes
3answers
3k views

Dynamic nginx domain root path based on hostname?

I am trying to setup my development nginx/PHP server with a basic master/catch-all vhost config so that I can created unlimited ___.framework.loc domains as needed. server { listen 80; ...
4
votes
4answers
6k views

Howto Nginx + git-http-backend + fcgiwrap (Debian Squeeze)

I am trying to setup git-http-backend with Nginx but after 24 hours wasting time and reading everything I could I think this config should work but doesn't. server { listen 80; server_name ...
4
votes
3answers
7k views

Can Nginx handle php (or similar fcgi) requests inside of an alias?

I am converting a legacy Apache server to Nginx and do not have the luxury of changing URL's or rearranging the filesystem. Is it possible to use nested location{} blocks in the Nginx configuration ...
3
votes
1answer
17k views

How do I change the NGINX user?

I have a PHP script that creates a directory and outputs an image to the directory. This was working just fine under Apache but we recently decided to switch to NGINX to make more use of our limited ...