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.

16419 questions
41
votes
2 answers

How to quick and easy remove part of an URL in Nginx with HttpRewriteModule?

I know about the HttpRewriteModule, but I don't really know how to handle regex and I would need to redirect all URLs within a certain directory to another, specifically: From: example.com/component/tag/whatever To: example.com/tag/whatever Could…
javipas
  • 1,292
  • 3
  • 23
  • 38
41
votes
2 answers

How to reduce number of sockets in TIME_WAIT?

Ubuntu Server 10.04.1 x86 I've got a machine with a FCGI HTTP service behind nginx, that serves a lot of small HTTP requests to a lot of different clients. (About 230 requests per second in the peak hours, average response size with headers is 650…
Alexander Gladysh
  • 2,343
  • 7
  • 30
  • 47
41
votes
2 answers

Merging variable with string in config file

I the have following setup in my conf file upload_set_form_field $upload_field_name.name "$upload_file_name"; But I want change chosen param name to: upload_set_form_field ($upload_field_name+"[name]") "$upload_file_name"; So I can get…
Swistak
  • 511
  • 1
  • 4
  • 4
40
votes
3 answers

Can nginx location blocks match a URL query string?

Can nginx location blocks match a URL query string? For example, what location block might match HTTP GET request GET /git/sample-repository/info/refs?service=git-receive-pack HTTP/1.1
Derek Mahar
  • 801
  • 2
  • 8
  • 15
40
votes
1 answer

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 it in the docs: In addition, all active keys and…
Jürgen Paul
  • 1,225
  • 4
  • 14
  • 21
40
votes
4 answers

Enable basic auth sitewide and disabling it for subpages?

I have a relatively straight forward config: upstream appserver-1 { server unix:/var/www/example.com/app/tmp/gunicorn.sock fail_timeout=0; } server { listen 80; server_name example.com; location / { proxy_pass…
Benjamin Wohlwend
  • 729
  • 2
  • 7
  • 14
39
votes
3 answers

Use HTTP/2.0 between nginx reverse-proxy and backend webserver

I use nginx as a reverse-ssl-proxy in front of a backend webserver that is capable of doing HTTP/2.0. I noticed that nginx proxies the requests to the backend server via HTTP/1.1 rather than HTTP/2.0. Is it possible to tell nginx to use an…
S1lentSt0rm
  • 929
  • 1
  • 8
  • 11
38
votes
6 answers

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 = 20M post_max_size = 25M and I restarted php5-fpm…
harryg
  • 841
  • 2
  • 10
  • 19
38
votes
3 answers

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 ;Domain=backend.int, because the backend does not know…
Tobia
  • 1,143
  • 1
  • 12
  • 19
37
votes
1 answer

For Server-Sent Events (SSE) what Nginx proxy configuration is appropriate?

I've read a bunch of different questions on what Nginx configuration is appropriate for SSE and came up with some confusing results regarding what settings to…
c4urself
  • 5,270
  • 3
  • 25
  • 39
37
votes
3 answers

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 balancers? (load balancing load balancers?) I…
Sherzod
  • 481
  • 1
  • 4
  • 6
37
votes
4 answers

Forward Custom Header from Nginx Reverse Proxy

I have an nginx web server acting as a reverse proxy to forward requests on to Apache for additional handling (I'm begging you not to ask why). I have a request to which I'm trying to attach a custom header and I'd like for nginx to forward that…
Rob Wilkerson
  • 1,365
  • 4
  • 16
  • 24
37
votes
3 answers

Wildcard vhosts on Nginx

I've just installed Nginx on my server and am extremely happy with the results, however I still cannot figure out how to insert wildcard virtual hosts. This is the [directory] structure I'd like: -- public_html (example.com) ---subdoamin 1…
rorygilchrist
  • 371
  • 1
  • 3
  • 3
37
votes
6 answers

How to stop nginx on Mac OS X

I've installed and configured nginx server on my Mac from MacPorts sudo port install nginx Followed the recommendation from the port installation console and created the launchd startup item for nginx, then started the server. Renamed…
Alex Kaushovik
  • 543
  • 1
  • 4
  • 10
36
votes
3 answers

nginx use $server_name on ssl_certificate path

How I can use a variable name in file path ? ssl_certificate /home/ec2-user/.certificados/$server_name.crt; ssl_certificate_key /home/ec2-user/.certificados/$server_name.key;
Claytinho
  • 473
  • 1
  • 4
  • 6