Questions tagged [nginx]

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

Nginx is a web server and mail proxy known for its high performance and small resource footprint. It is used in many places as a replacement to Apache and also as a front end server to static content or reverse proxying. Nginx is developed under a BSD-like license by Kazakhstani developer Igor Sysoev.

Nginx comes with diverse modules that enable it to perform various different tasks such as load balancing, URL rewriting, request rate limiting, content compression, raw TCP proxying and integration with tools like memcached or scripting languages like Lua.

Nginx is being used by some of the worlds busiest sites like WordPress, Sourceforge, Github and Reddit. Its market share has been raising from 7% in 2008 to over 30% as of June 2016 according to W3techs statistics.

After nine years of development, Nginx 1.0 stable was released on April 2011.

17017 questions
31
votes
2 answers

Disabling URL decoding in nginx proxy

When I browse to this URL: http://localhost:8080/foo/%5B-%5D server (nc -l 8080) receives it as-is: GET /foo/%5B-%5D HTTP/1.1 However when I proxy this application via nginx (1.1.19): location /foo { proxy_pass …
Tomasz Nurkiewicz
  • 774
  • 1
  • 6
  • 10
31
votes
6 answers

Nginx Setting server_names_hash_max_size and server_names_hash_bucket_size

We are using Nginx as a reverse proxy to Apache in a service that gives anyone their own website. At account creation, the system creates a new nginx conf file for the domain with two entries, one for port 80, the other for 443. We are noticing that…
jasonspalace
  • 313
  • 1
  • 3
  • 4
31
votes
11 answers

Nginx redirects to port 8080 when accessing url without slash

when accessing: http://example.com/somefolder --> http://example.com:8080/somefolder I have tried this: http { port_in_redirect off; Any ideas?
Chris Muench
  • 487
  • 3
  • 10
  • 31
31
votes
4 answers

Maintenance page on nginx, best practices

I want to configure the server to show a maintenance page when it exist. I tried this code and works: location / { try_files /maintenance.html $uri $uri/ @codeigniter; } But I noticed it would be served with a 200 status code, and it can cause…
NeDark
  • 463
  • 1
  • 6
  • 10
31
votes
1 answer

NGINX - throttle requests to prevent abuse

The reason I want to do this is because users develop against our API with JavaScript, and some developers screw up and cause visitors to slam the server with AJAX requests. When this happens, I want to be able to throttle the API requests to…
orokusaki
  • 2,763
  • 4
  • 32
  • 43
31
votes
6 answers

Nginx proxy by Request Method

Is it possible/how can I configure an Nginx location block to proxy to different backends depending on the request method (ie. GET/POST)? The reason is, I am currently handling the 2 methods at 2 different URLs (one via http proxy and the other via…
Brenton Alker
  • 470
  • 1
  • 4
  • 7
30
votes
2 answers

Site is accessible by domain in all browsers but Chrome

I'm trying to set up a website using an Ubuntu machine running nginx. For some reason, I'm able to access the site by the domain name in Safari and Firefox, but in Chrome it's unable to access the server. However, I'm able to use curl, Postman, etc.…
Andrew Gwilliam
  • 410
  • 4
  • 6
30
votes
2 answers

Nginx: How To Completely Disable Request Body Buffering

I'm trying to set up Madsonic on my Ubuntu box and have Nginx run in front of it. Problem is, I keep getting this warning when I try to upload stuff through the web interface: 31115#0: *14 a client request body is buffered to a temporary file This…
rad
  • 421
  • 1
  • 4
  • 7
30
votes
3 answers

Disable TLS 1.0 in NGINX

I have a NGINX acting as a reverse proxy for our sites and is working very well. For the sites that need ssl I followed raymii.org to make sure to have as strong of a SSLLabs score as possible. One of the sites needs to be PCI DSS compliant but…
Shawn C.
  • 403
  • 1
  • 5
  • 7
30
votes
7 answers

How do I force NGINX to load new static files?

I recently pushed a major update to a site and I'm having an issue where some people can't log in because their browser is loading old javascript files. Some of the things I have done include: Cache busting all javascript files Set sendfile off in…
jwerre
  • 768
  • 3
  • 12
  • 26
30
votes
3 answers

nginx rate limiting with X-Forwarded-For header

I'm looking into rate-limiting using nginx's HttpLimitReqModule. However, requests are all coming from the same IP (a loadbalancer), with the real IP address in the headers. Is there a way to have nginx rate-limit based on the ip in the…
John Brodie
  • 403
  • 1
  • 4
  • 6
30
votes
1 answer

Reverse Proxy - Remove Subdirectory

In the near future I'm going to have 3 nginx servers. One is a reverse proxy for SSL for the two others. So, for example, I go to: https://www.mysitename.com/site1 The two other servers in this example are site1 and site2. I installed the SSL…
Chromag
  • 303
  • 1
  • 3
  • 4
30
votes
6 answers

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 other vhosts to be access via pre-defined domains.
DanH
  • 827
  • 2
  • 9
  • 26
30
votes
5 answers

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 ###.###.###.###; server_name whatever.server; …
Ben Lee
  • 666
  • 2
  • 9
  • 24
30
votes
2 answers

NGINX add_header, adding multiple headers

I am trying to send multiple headers add_header Access-Control-Allow-Origin http://dev.anuary.com; add_header Access-Control-Allow-Origin https://dev.anuary.com; However, instead NGINX makes them into Access-Control-Allow-Origin:…
Gajus
  • 851
  • 5
  • 16
  • 28