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

learn more… | top users | synonyms

7
votes
2answers
7k 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 ...
7
votes
1answer
618 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
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 ...
7
votes
2answers
4k 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 ...
6
votes
1answer
7k 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 ...
5
votes
2answers
5k views

OCSP validation - unable to get local issuer certificate

I'm new to setup SSL from the scratch and did my first steps. I bought a SSL cert from RapidSSL for my domain and followed there steps to install the cert. In general the cert is valid and working on ...
5
votes
1answer
22k 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 ...
3
votes
2answers
1k views

Nginx 1.6.3 to 1.8 upgrade

I'm on Linux Mint LMDE. I just receive a upgrade of nginx from 1.6.3 to 1.8.0 with aptitude and now, I got blank page on all my websites Here my configuration : server { listen 80; ...
3
votes
1answer
4k views

maintaining redirects in nginx from an external source

I am in the situation to give our marketing department the opportunity to maintain their redirects by their own. Until now, they passed the information to the IT department and we maintained it for ...
3
votes
1answer
3k 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
2k 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. ...
15
votes
2answers
2k 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 ...
10
votes
2answers
1k views

Prefer IPv4 incoming connections over IPv6

We run a social/local service that benefits from geolocating the IP of users. The problem is that with IPv6, geolocation is quite a bit spottier than with IPv4. Is there a way to prefer incoming ...
9
votes
1answer
3k views

Understanding the nginx proxy_cache_path directive

Suppose I have this nginx config file proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=myCache:8m max_size=100m inactive=1h; What does the keys_zone=myCache:8m mean? There's not much said to ...
7
votes
5answers
3k views

Nginx + Apache trailing slash redirect [closed]

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
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
2k views

How to define which SSL certificate nginx sends first with SNI?

I use nginx 1.2.7 with OpenSSL 0.9.8o on Debian Squeeze for about 30 domains. On two of them I enabled SSL which works fine on both. The SSL config is use for both domains: listen 443 ssl; ...
5
votes
1answer
2k 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
6k 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
4k 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
5answers
7k views

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

Right now, I have this: 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 ...
2
votes
1answer
9k views

How To use fail2ban for Nginx? [closed]

How can I use fail2ban on an Nginx server? What are the rules to put in the jails.conf?
2
votes
2answers
1k views

Building an SSL server farm

I'm interested in building the the architecture in the article referenced below. I currently have a modestly-priced layer-4 load balancer and my application servers are the SSL endpoints. I want to ...
2
votes
3answers
4k views

Is it possible to log the response data in nginx access log?

I am trying to print the response data for development/debugging purposes. I couldn't find a similar question or any info on this. If you do, please add a comment.
2
votes
4answers
4k views

nginx logrotate config

Whats the best way to rotate nginx logfiles? In my opinion, I should create a file "nginx" in /etc/logrotate.d/ and fill it with the following code and do a /etc/init.d/syslog restart after that. ...
2
votes
1answer
5k views

How can I observe what nginx is doing? (to solve: “1024 worker_connections are not enough”)

I have a very low traffic site running on nginx, with 4 workers, 1024 connections each. Every several hours I start seeing in the error log "1024 worker_connections are not enough", and my site slows ...
2
votes
3answers
2k views

NginX & PHP-FPM, random 502

2010/09/19 14:52:07 [error] 1419#0: *10220 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: [...], server: [...], request: "POST /[...] HTTP/1.1", ...
1
vote
1answer
362 views

nginx - limiting bandwidth usage per server block

In Apache we have some great solutions for limiting the bandwidth usage per vhost, like mod_bandwidth. However, since I started using nginx, I couldn't find a way of limiting and monitoring the ...
0
votes
2answers
7k views

How to optimize Time To First Byte (TTFB)?

I have nginx+apache web-server with several sites. But with very long Time To First Byte (TTFB): 0,5-2 seconds for every request (for static & dynamic content). How to optimize Time To First ...
13
votes
3answers
10k 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 ...
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 ...
10
votes
3answers
16k views

Understanding this error: apr_socket_recv: Connection reset by peer (104)

So, if I do some benchmarking with apache benchmark (ab), and I use large numbers of requests. Then sometimes in the middle of a test I get this error. I don't even know what it means. So how can I ...
8
votes
3answers
1k views

nginx: How to prevent an exactly named SSL server block from acting as the catchall for all SSL

I have a web server with many virtual servers. Only 1 of which is SSL. The problem is, because there is no catchall server block listening for SSL, any https request to the other sites is served by ...
7
votes
2answers
12k views

Nginx - How to redirect users with certain IP to special page

I run quite a big image gallery and there are 5 visitors that create an enormous amount of traffic by downloading the whole site every day using webcopiers. Those visitors have static IPs as it seems. ...
7
votes
1answer
3k views

NGINX convert HEAD to GET requests

Due to some terrible design decisions, we have an application unable to respond to HTTP HEAD requests (Returns 'Method Not Allowed'). Modifying the software to return HEAD requests correctly would be ...
7
votes
1answer
10k views

How do I set a default host for nginx?

I'm trying to figure out how to set a default host for my nginx installation. I found this article in the nginx Wiki: http://wiki.nginx.org/NginxVirtualHostExample#A_Default_Catchall_Virtual_Host ...
7
votes
1answer
3k views

Use Nginx to server different pages depending on IP address/subnet

For reasons to hideous to go into... I'm using Nginx as a webserver and would like it to serve one page for internal users (say on 10.0.0.0/16) and another page to external users on any other IP ...
6
votes
1answer
5k views

How to upgrade nginx from 1.2 to 1.6 on debian 7

I've looked through the whole web but couldn't find anything ! I modified sources.list but the server is tuck to nginx 1.2 , I don't know what to do please help
6
votes
1answer
4k views

Working Nginx fastcgi_cache php-fpm cache and static file caching configuration?

Nginx wiki is very vague with explanation as to how to properly setup nginx with php-fpm with fastcgi_caching for sites which have cookies i.e. wordpress, drupal, vbulletin etc. I downloaded a ...
5
votes
1answer
1k views

Splitting long lines in a nginx configuration file

In order to not pass garbage to the back-end, I have a strict regex for a location directive. It looks like this: location ^~ ...
4
votes
1answer
7k views

How to use nginx as reverse proxy with multiple IPs and SSL?

I would like to setup nginx reverse proxy with multiple domains and an IP for each of them to use different SSL Certs. I run Ubuntu as OS which is installed on a KVM/Qemu VM. As I understand nginx, ...
3
votes
2answers
115 views

NGINX Serving Large mp4 Files extremely inefficiently

I am currently running nginx/1.0.15 on a Centos 6.6 OS. The server has the following specs: Intel(R) Atom(TM) CPU C2750 @ 2.40GHz (8 cores) 32GB Ram 5 x 6000 GB 7200 RPM (Raid 10) The Problem The ...
3
votes
1answer
11k views

How to configure php-fpm to log logs to log files configured in nginx virtualhosts

I have Fedora 16 with nginx and php-fpm. Everything is working very good. All logs with php notice,warnig error etc. are in /var/log/php-fpm/www-error.log. Is there a way to configure php-fpm to write ...
3
votes
1answer
4k views

Nginx - basic http authentication on PHP-script

I added a PHP-Script that serves as "cgi-bin", Configuration: location ~^/cgi-bin/.*\.(cgi|pl|py|rb) { gzip off; fastcgi_pass 127.0.0.1:9000; fastcgi_index cgi-bin.php; ...
3
votes
2answers
4k views

Prevent nginx from redirecting traffic from https to http when used as a reverse proxy

Here's my abbreviated nginx vhost conf: upstream gunicorn { server 127.0.0.1:8080 fail_timeout=0; } server { listen 80; listen 443 ssl; server_name domain.com ~^.+\.domain\.com$; ...
3
votes
1answer
4k views

gzip compression doesn't work in nginx reverse proxy setup

We have nginx in front of an Apache server in reverse proxy mode. We initially had Apache compressing files using mod_deflate, however that proved to cause problems with some instances of Internet ...