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

7
votes
2answers
2k views

uploading files greater than 1MB = connection resets

I'm using nginx on the frontend as "proxy cache" and apache on the backend, i've set my PHP settings to the following: error_log = /var/www/site1/php_error.log error_reporting = 22527 file_uploads = ...
7
votes
2answers
12k 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 ...
7
votes
5answers
3k views

Which reverse-proxies support HTTP/1.1 ETag and If-None-Match headers?

I'm developing a caching system for an ecommerce platform that will use a reverse proxy for caching. I plan to handle invalidation by using proper HTTP/1.1 headers. That is, I will set an ETag on ...
7
votes
1answer
2k views

Why isn't the Nginx Gzip Precompression module working?

I'm currently trying to set up Nginx to serve all of my static files. Since they will not be changed very frequently at all I want to us the gzip_static module to allow me to pre-gzip copies of my ...
7
votes
3answers
7k views

How do I configure Nginx proxy_pass Node.js HTTP server via UNIX socket?

I am trying to configure a Nginx server to connect to a Node.js HTTP server via a UNIX domain socket. The Nginx configuration file: server { listen 80; location / { proxy_pass ...
7
votes
2answers
4k views

SSH over HTTPS with proxytunnel and nginx

I'm trying to setup an ssh over https connection using nginx. I haven't found any working examples, so any help would be appreciated! ~$ cat .ssh/config Host example.net Hostname example.net ...
7
votes
1answer
1k views

Can I alias all directory requests to a single file in nginx?

I'm trying to figure out how to take all requests made to a particular directory and return a json string without a redirect, in nginx. Example: curl -i http://example.com/api/call1/ Expected ...
7
votes
1answer
1k views

NGINX on OSX - Performing terribly slow

I I've been trying to get NGINX up and running on my OSX 10.7 Lion computer. I have it running however simple html pages every few are taking a long time to load; for example: <html> ...
7
votes
2answers
635 views

nginx proxy retry while backend is restarting

Nginx returns 502 while the backend is restarting. How can I make nginx proxy retry N times with M seconds delay? Is there a plugin or something else?
7
votes
3answers
776 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
3answers
672 views

What is the best tool to aggregate traffic stats from multiple nginx servers?

The setup: 2 or more nginx machines each machine has the same virtual hosts traffic is load balanced via DNS to each machine I need to figure out what are the best tools to use to get some traffic ...
6
votes
4answers
1k views

Serving html from linux ramdisk

I have seen a somewhat dated tutorial that suggest serving html files with a ramdisk like this: mkfs -q /dev/ram1 102400 I also find another source that use something like this: mount -t tmpfs -o ...
6
votes
3answers
6k views

What is the best nginx compression gzip level?

I'm using nginx reverse proxy cache with gzip enabled. However, I got some problems from Android applications HTTP-requests to my Rails JSON web service. It seems when I turn off reverse proxy cache, ...
6
votes
3answers
8k 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: ...
6
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. ...
6
votes
3answers
9k 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 ...
6
votes
6answers
10k views

Launch Nginx on startup

I was able to install and run nginx, and passenger but i'm not able to have nginx come up whenever i reboot my server. To start the nginx process i just type in sudo /opt/nginx/sbin/nginx. From my ...
6
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 ...
6
votes
2answers
400 views

Detecting Slashdot effect in nginx

Is there a way I can make Nginx to notify me if hits from a referrer goes beyond a threshold? e.g If my website is featured at Slashdot and all of sudden I have 2K hits coming in an hour I want to be ...
6
votes
4answers
5k views

Nginx + PHP 5.3.3 (with php-fpm) - memory usage?

I recently bought Xen VPS (linode.com) with Debian 5.0 Lenny (i386), 512MB RAM. At the moment I have only three small websites (built with Drupal) with about 600 users per day in total running on this ...
6
votes
4answers
3k views

nginx subdomain rewrite

Yet another nginx rewrite rule question How can I do a rewrite from http://www.*.domain.com to http://*.domain.com ? thanks in advance -- Deb EDIT: I'm sorry I didn't see the textile formatting ...
6
votes
8answers
19k views

Performance of IIS+ASP.NET vs (NGINX + FastCGI + Mono or XSP)?

How much requests each can handle? How many RAM needed? As I remember FastCGI are opened initialized processes, each can handle one request. What about multithreading?
6
votes
7answers
5k views

Handling http and https requests using a single port with nginx

i was wondering if nginx is able to handle http and https requests on the same port. [*] This is what i'm trying to do. I'm running a web server (lighttpd) handling http requests, and a C program ...
6
votes
6answers
359 views

How to keep programs from source up to date?

I'm designing a new server setup for hosting multiple websites. (Shared hosting for my clients over at SliceHost.) I've recently moved away from the traditional LAMP setup and chosen Ubuntu, Nginx, ...
6
votes
3answers
5k 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 ...
6
votes
4answers
964 views

Nginx with SPDY Draft 3, is possible?

I'm currently using Nginx 1.4.1 with SPDY module. Unfortunately, the Nginx SPDY module, work only with the Draft 2 of protocol. Is there a way to use Nginx, with SPDY Draft 3?
6
votes
1answer
10k views

Cross Origin Resource Sharing (CORS) with nginx / chrome

I have a website with the following segmentation: api.example.com developers.example.com example.com I would like to allow both example.com and developers.example.com to make AJAX requests to ...
6
votes
4answers
3k views

Experience in migrating from Apache to nginx?

I'd like to get some feedback about a migration From Apache to nginx. My goal is to reduce the memory footprint of the web server. Currently, I use the following modules.features on Apache: multiple ...
6
votes
3answers
2k views

node.js, mongodb, redis, on ubuntu performance degradation in production, RAM is free, CPU 100%

As the question title suggests, I'm having an hard time to figure out what can be improved on my application(or tuned in the os, ubuntu) to achieve an acceptable performance. But first I'll explain ...
6
votes
3answers
6k 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 ...
6
votes
3answers
1k views

NGINX as http proxy server (not reverse proxy) [closed]

Is it possible to use nginx as ordinal http/https proxy? (not reverse http proxy) UPDATE: Yes, i know about squid/oops/tinyproxy/etc. Please do not answer if you dont know answer to question (or just ...
6
votes
3answers
7k 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 ...
6
votes
1answer
2k 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
835 views

Nginx add_header for a 50* page

I'm currently trying to get nginx to add a header to the response when it is sending some kind of 50* error. I already have an add_header directive on the http block, and that gets respected for all ...
6
votes
1answer
1k views

Reference root location as a variable in server {} block

In my nginx server {} block I have root defined with a path. How can I later reference this path? This is what I'm trying to accomplish: server { listen 80; root /var/www/foosite; ... ...
6
votes
3answers
2k views

nginx passing back custom header

I have the following example location / { proxy_read_timeout 2000; proxy_next_upstream error; proxy_set_header X-Real-IP ...
6
votes
4answers
8k views

Controlling Nginx proxy target using a cookie?

I'm trying to convert a reverse proxy using an interesting Apache mod_rewrite setup to use Nginx instead (due to external concerns we are moving from Apache to Nginx, and most everything works fine ...
6
votes
4answers
3k views

How can I optimize nginx? From benchmarking it seems Apache2 is faster for static delivery

On one of my vps servers I've setup both Apache2 and nginx, nginx on port 8080 and Apache2 on 80, and have created a static HTML file. static HTML/Apache2: meder@meder-desktop:~$ sudo ab -n 1000 -c ...
6
votes
1answer
106 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 ...
6
votes
1answer
2k views

Nginx : strip header on HTTP, add header on HTTPS

I'm configuring an Nginx server so as to serve as a reverse proxy to serve a Django app (run on Gunicorn). My problem is that I want my site secured with HTTPS, and so I want my Django app to be able ...
6
votes
3answers
7k views

Why cache static files with Varnish, why not pass

I have a system runnning nginx / php-fpm / varnish / wordpress and amazon s3. Now I have looked at a lot of configuration files while setting up the system, and in all of them I found something like ...
6
votes
1answer
7k 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 ...
6
votes
2answers
7k views

User per virtual host in Nginx

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

Mapping hudson to a subdomain through nginx proxying

I'm now trying to setup nginx as a reverse proxy for Hudson so it can be access on http://build.example.com directly. I've already installed Hudson on Tomcat and verified that I can access Hudson on ...
6
votes
4answers
2k 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
1answer
2k views

How can I use environment variables in Nginx.conf

[Cross-posted and edited down from http://stackoverflow.com/questions/21933955 as it was considered too sysadmin-like for StackOverflow.] I have a docker container running Nginx, that links to ...
6
votes
1answer
6k views

Nginx 1.2.2: How to get try_files to work?

I updated nginx recently to version 1.2.2 and the following entry seems to be broken; presumably a change in syntax between versions? location / { # First attempt to serve request as ...
6
votes
3answers
2k views

nginx closes connection on some pictures

There is problem with nginx. It closes connection before client finishes download. It looks like: $ wget -O /dev/null http://www.site.com/images/theme/front/clean.jpg --2012-07-11 21:37:03-- ...
6
votes
1answer
9k views

How to adjust nginx keepalive_timeout?

I am using nginx along with php-fpm to server a busy mysql-based site. Currently I am using keepalive_timeout = 5, however I have no clear idea about how to optimally adjust it. So appreciate your ...
6
votes
1answer
1k views

What causes a 400 Bad Request error for null (“”) and why would our nginx logs have so many?

Daily logs from Logwatch regularly report 400 Bad Request, null: 1744 Time(s) from our nginx logs. The log entries look like: 123.123.123.123 - - [25/Jan/2011:14:44:19 -0500] "-" 400 173 "-" "-" ...