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

9
votes
2answers
715 views

How to handle encrypted and unencrypted http connections through a single port

Please, take a look at the following diagram. How should this work? When a remote requests http:// myhost.com:8080/* , the request should be forwarded to the http server that listens on port 8008 ...
8
votes
3answers
903 views

Is nginx suited for serving PDFs?

This is a dummy question. I have to give public access to PDFs, let's say 8 MB / file. It seems to me that nginx will serve any kind of files, as long as they are static. But someone tells me nginx ...
8
votes
3answers
6k views

NginX Log Rotation

I am serving a couple different domains through NginX on the same server and they each log to their own file. I need to set up a script to rotate, and compress these files and add it to cron. I ...
8
votes
2answers
15k 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 ...
8
votes
3answers
18k 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 ...
8
votes
5answers
16k views

How to restart nginx?

For me, I run "killall nginx" and start it by "sbin/nginx", anyone has a better restart script? BTW: I install nginx from source, i do not find 'service nginx' command or /etc/init.d/nginx
8
votes
7answers
5k 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 ...
8
votes
4answers
3k 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
442 views

Make Nginx server respond slowly

So I have a spammer on my site. I could block his IP using 'deny', but then he'll just change his IP and I'll have to keep playing cat and mouse with him. Instead, I am curious if there is a way to ...
8
votes
2answers
16k 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 ...
8
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 ...
8
votes
3answers
16k 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; ...
8
votes
1answer
11k views

how do I get nginx to forward HTTP POST requests via rewrite?

My iOS app is currently accessing domain A via http POST but I would like to forward all requests to domain B. If I use the usual "rewrite ^/(.*)$ http://mydomain/$1 permanent;" the POST data ...
8
votes
1answer
10k 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 ...
8
votes
2answers
3k views

Setting Nginx to catch all unhandled vhosts

If I already have a bunch of virtualhosts, how can I create a virtual host to handle requests that don't match any of the virtualhosts? (i.e. access by IP, another domain linking to IP, .etc .etc)
8
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 ...
8
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 "-" "-" ...
8
votes
1answer
893 views

Nginx learning resources

I would like to learn Nginx (I'm trying to setup a nginx+thin(s) rails solution on linux). I know russian but the original nginx documentation is a bit hard to understand for me. Please advice on good ...
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
1answer
2k views

How do I configure nginx to accept gzip requests?

I know that you can use nginx HttpGzipModule to gzip responses. Can you als use it to enable nginx to handle gzip-compressed requests, i.e. ones with the request header: Content-Encoding: gzip ? ...
7
votes
3answers
14k views

How to restart Nginx on Mac OS X?

I just installed Nginx on Mac OS X (thanks http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/), but how do I restart Nginx on Mac OS X? Thanks!
7
votes
3answers
25k views

What is wrong in my php-fpm configuration?

I have a 64-bit server but only 256MB of RAM. So, I moved to nginx server with fast-cgi to connect to PHP. I have PHP 5.3.6 running. The issue is that after every two or three days when I try to ...
7
votes
3answers
18k views

How can I make sure that Nginx serves plaintext files as a download, instead of inline?

I have Rails application (Redmine) which works with Nginx. If I am clicking on any attachment my browser (firefox, ie, chrome) ask me to download file. But if I am clicking on txt-type attachment my ...
7
votes
1answer
12k views

Nginx multiple location issues

I'm currently trying to break apart 3 applications from one repository into 3, but keeping the url structure, so basically different locations under the same domain have to be delivered by different ...
7
votes
3answers
7k views

nginx: dump HTTP requests for debugging

Ubuntu 10.04.2 nginx 0.7.65 I see some weird HTTP requests coming to my nginx server. To better understand what is going on, I want to dump whole HTTP request data for such queries. (I.e. dump all ...
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 ...
7
votes
2answers
1k 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 ...
7
votes
2answers
2k views

Nginx : thousands of server_name

how can I configure Nginx restrict to thousands of different server_name without creating thousands of external config files or writing a very long server_name line ? Indeed, I would like Nginx be a ...
7
votes
2answers
7k views

nginx send blank 200 responses

I'm configuring a failover server tasked to accept any incoming request, and reply with blank 200 response. The idea is to minimize the reply time and to ensure we dont send any 40x or 50x. I tried ...
7
votes
2answers
2k views

Strange Bittorrent Log On My Server

I don't know if the following log has something to do with my site being down sometime. I have lot of websites on my server and they don't have any logs like the following: 117.169.1.85 - - ...
7
votes
2answers
3k views

Multiple SSL vhosts using wildcard certificate in nginx

I have two hostnames sharing the same domain name which I want to serve over HTTPs. I've got a wildcard-SSL certificate and created two vhost configs: Host A listen 127.0.0.1:443 ssl; ...
7
votes
6answers
2k views

How can I keep Apache from falling over?

I have a pair of servers hosting a single Magento ecommerce site with moderate traffic (60k page views per day reported from google analytics, I think about 80k reported on the server itself). The ...
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 ...
7
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 ...
7
votes
1answer
2k views

mod_rpaf problems with Nginx front, Apache back-end after Ubuntu upgrade

I'm running an Nginx front-end for static files, and proxying to an Apache backend for PHP and Passenger, using Apache's mod_rpaf to set the correct remote IP address on the backend. Everything worked ...
7
votes
3answers
8k 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 ...
7
votes
3answers
3k 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 ...
7
votes
3answers
3k 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 ...
7
votes
1answer
9k 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
2answers
1k views

Is it possible to use Shibboleth 2 with Nginx + Passenger?

Do you know if it is possible to use Nginx with Shibboleth?
7
votes
3answers
13k views

nginx rewrite for an url with parameters

I have an URL of this type: http://www.example.com/?param1=val1&param2=&param3=val3&param4=val4&param5=val5 And I want to redirect it to this one: ...
7
votes
2answers
5k views

When nginx is configured as reverse proxy, can it rewrite the host header to the downstream server like Apache's ProxyPreserveHost?

I can't seem to find the equivalent of Apache's ProxyPreserveHost http://httpd.apache.org/docs/2.0/mod/mod%5Fproxy.html#proxypreservehost option in nginx. This is required to reverse proxy to virtual ...
7
votes
2answers
3k 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
5answers
4k 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
2answers
6k 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
3answers
8k 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
1answer
2k 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
897 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
2answers
3k 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 ...
7
votes
2answers
596 views

How to set only specific nginx server block into maintenance mode programmatically

I am looking for a solution to automate one of our application's deployment process. In the beginning of deployment, I would like to programmatically set the specified server into maintenance mode and ...