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
5
votes
2 answers

nginx: Specify custom headers in rewritten location blocks

I'm trying to set some headers only for specific location blocks in nginx. The problem I have is that those location blocks contain rewrite statements, which apparently seem to drop the custom headers. In this example, I have two rules I…
Etienne Perot
  • 103
  • 1
  • 8
5
votes
1 answer

Web Server Routing Based On Location

I have a website that has users from both Hong Kong and Australia. Unfortunately, since the server is located in Australia, users from Hong Kong are going to suffer latency problems. Traffic has to go through US before travelling back to…
Eric
  • 153
  • 3
5
votes
1 answer

Nginx access log shows authenticated user "admin"

I came across a line in my Nginx access log: 218.201.121.99 - admin [12/Dec/2012:18:33:18 +0800] "GET /manager/html HTTP/1.1" 444 0 "-" "-" Let me stress that there is only 1 record with this IP. Notice the authenticated user admin. After some…
bearcat
  • 163
  • 1
  • 4
5
votes
3 answers

How to deploy same stack+configuration to multiple server?

Currently I have 2 VPSes, setup and configured almost exactly like this, with some other minor Nginx configurations. I did it all manually I want to get few other VPSes and deploy the exact same setup and configuration but I'm not sure which tool…
Matt Norad
  • 65
  • 5
5
votes
1 answer

Nginx limit_req_zone ip exceptions

I use: http { limit_req_zone $binary_remote_addr zone=one:10m rate=5r/s; } server { location ~ \.php$ { limit_req zone=one burst=2 nodelay; try_files $uri $uri/ /index.php; root /var/www/; …
Tony
  • 51
  • 1
  • 2
5
votes
2 answers

How do I get nginx to issue 301 requests to HTTPS location, when SSL handled by a load-balancer?

I've noticed that there's functionality enabled in nginx by default, whereby a url request without a trailing slash for a directory which exists in the filesystem automatically has a slash added through a 301 redirect. E.g. if the directory css…
growse
  • 8,020
  • 13
  • 74
  • 115
5
votes
1 answer

nginx connection reset

When first visiting my site after not visiting it for a few minutes, the connection is "reset" 100% of the time. I get this message when debug is turned on, along with a 400 bad request status message: client prematurely closed connection while…
Steve
  • 51
  • 1
  • 1
  • 3
5
votes
3 answers

How to configure nginx to redirect all request from domain aliases to main domain?

I do have an nginx server which responds to several domains and I do want to redirect all request to the main domain. Example: website responding for xxx xxx.example.com yyy.example.com $hostname for both http and https. I want to configure the…
sorin
  • 8,016
  • 24
  • 79
  • 103
5
votes
2 answers

Nginx Multiple If Statements Cause Memory Usage to Jump

We need to block a large number of requests by IP address with nginx. The requests are proxied by a CDN, and so we cannot block with the actual client IP address (it would be the IP address of the CDN, not the actual client). So, we have…
5
votes
2 answers

nginx won't serve an error_page in a subdirectory of the document root

Here's a snippet of my nginx configuration: server { error_page 500 /errors/500.html; } When I cause a 500 in my application, Chrome just shows its default 500 page (Firefox and Safari show a blank page) rather than my custom error page. I know…
Brandan
  • 151
  • 4
5
votes
1 answer

nginx SSL error

When I run sbin/nginx -t I get the following error [emerg]: the "ssl" parameter requires ngx_http_ssl_module in /root/cloudfoundry/.deployments/devbox/deploy/nginx/nginx-0.8.54/conf/nginx.conf:98 configuration file…
user1745933
  • 51
  • 1
  • 1
  • 2
5
votes
1 answer

nginx rewrite URL to redirect only if a cookie is not set

I have two domains www.domain.com and www.domain.com.tw. I want the user to be redirected to the closest server, but if they want to view the other server, they can by clicking a link in the site. I tried to do it with a cookie, but it doesn't seem…
richard
  • 153
  • 1
  • 3
5
votes
4 answers

Forcing a particular SSL protocol for an nginx proxying server

I am developing an application against a remote https web service. While developing I need to proxy requests from my local development server (running nginx on ubuntu) to the remote https web server. Here is the relevant nginx config: server { …
vitch
  • 630
  • 2
  • 8
  • 10
5
votes
1 answer

Using nginx's proxy_redirect when the response location's domain varies

I am making an web app using SoundCloud's API. Requesting an MP3 to stream involves two requests. I'll give an example. Firstly: http://api.soundcloud.com/tracks/59815100/stream This returns a 302 with a temporary link to the actual MP3 (which…
Chalky
  • 51
  • 1
  • 1
  • 2
5
votes
2 answers

Nginx with PAM authentication through pam_script

Have anyone set up such a configuration? It's not working for me. I've installed nginx-extras on Ubuntu 12.04 (it's built with PAM module), and added to site config: location ^~ /restricted_place/ { auth_pam "Please specify login…
Envek
  • 223
  • 3
  • 7