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

10
votes
4answers
14k 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
11k 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
1answer
6k views

Nginx - rewrite or return for redirection?

I've got two options (return and rewrite) for redirection and I'm not sure which is recommended for performance, SEO, etc: ## Redirect from non-www to www server { server_name example.com; ...
10
votes
1answer
17k 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 ...
10
votes
3answers
36k 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; ...
10
votes
4answers
12k views

Need to increase nginx throughput to an upstream unix socket — linux kernel tuning?

I am running an nginx server that acts as a proxy to an upstream unix socket, like this: upstream app_server { server unix:/tmp/app.sock fail_timeout=0; } server { listen ...
10
votes
3answers
17k 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: ...
10
votes
5answers
9k 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
6k 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)
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
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 ...
10
votes
2answers
4k views

Why is Internet Explorer 11 unable to connect to HTTPS sites when TLS 1.2 is enabled?

Normally I don't use Internet Explorer at all. I use it only in design time for interface tests (development machine and with unencrypted http). Every week I run the SSL Labs server test which says ...
10
votes
5answers
15k 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
4answers
7k 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?
9
votes
2answers
3k 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 ...
9
votes
3answers
7k 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
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 ...
9
votes
3answers
370 views

How to make redundant load balancers?

I understand that the purpose of load balancers is to balance load between your servers and keep track of instance health, etc. But what if load balancer itself fails? How do you set up redundant load ...
9
votes
2answers
4k 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 - - ...
9
votes
1answer
16k 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 ...
9
votes
5answers
9k 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
4answers
2k views

Advantages of Using Nginx or HA Proxy as Load Balancer

In our environment we us both Nginx and HA Proxy on different clusters. Are there advantages of using one over the other? Or, what is the best way to go about load balancing a basic LAMP server ...
9
votes
3answers
5k 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 ...
9
votes
1answer
5k views

nested locations nginx

I'm having trouble understanding nested locations in nginx. I have two locations with some configuration directives in common, so rather than repeat the directives, I'd prefer to repeat the URI using ...
9
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 ...
9
votes
1answer
2k 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 ...
9
votes
1answer
970 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 ...
9
votes
2answers
8k 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 ...
9
votes
1answer
3k views

How do I use a custom 503 error page with Nginx?

I have implemented rate limiting with Nginx (which works excellently, by the way) and would like to display a custom 503 error page. I have followed examples on the web without luck. I am running ...
9
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 ? ...
9
votes
2answers
1k views

API Management Solutions [closed]

I'm currently building an API and am looking for a tool to allow me to monitor (in a GUI) and rate-limit usage. I've come across a few enterprise solutions including: http://apigee.com/ ...
9
votes
3answers
1k views

nginx + fastCGI + Django - getting data corruption in the responses sent to the client

I am running Django behind nginx using FastCGI. I have discovered that in some of the responses sent to the client, random data corruption is occurring in the middle of the responses (might be a ...
9
votes
2answers
728 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
969 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
7k 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
10k 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 ...
8
votes
3answers
23k views

Nginx redirect one path to another

I'm sure this has been asked before, but I can't find a solution that works. A website has switched CMS services, but has the same domain, how do I set up an nginx rewrite for a single page? E.g. ...
8
votes
1answer
14k 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 ...
8
votes
1answer
12k views

An upstream response is buffered to a temporary file

I have a rather large and slow (complex data, complex frontend) web application build in RoR and served by Puma with nginx as reverse proxy. Looking at the nginx error log I see quite a few entries ...
8
votes
2answers
2k 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 ...
8
votes
3answers
22k 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 ...
8
votes
8answers
6k 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 ...
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 ...
8
votes
4answers
10k views

Increase PHP-FPM's max upload/post size

I'm running php5-fpm under Nginx on Ubuntu 14.04. I want to increase the max upload size. I have edited my /etc/php5/fpm/php.ini to have the following lines defined as below: upload_max_filesize = ...
8
votes
2answers
17k views

Nginx rewrite URL only if file exists

I need to write a rewrite rule for Nginx so that if a user tries to go to an old image url: /images/path/to/image.png and the file doesnt exist, try to redirect to: ...
8
votes
2answers
4k 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
3answers
511 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
3k views

Best way to prevent default server?

I have a number of vhosts, and I'd like to "turn off" the default vhost, either by blank page, error page, or generally whatever is the most efficient use of Nginx's resources, whilst only allowing ...
8
votes
2answers
22k 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
3answers
5k views

Is the PHP option 'cgi.fix_pathinfo' really dangerous with Nginx + PHP-FPM?

There has been a lot of talking about a security issue relative to the cgi.fix_pathinfo PHP option used with Nginx (usually PHP-FPM, fast CGI). As a result, the default nginx configuration file used ...