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
39
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
  • 501
  • 1
  • 4
  • 6
39
votes
3 answers

Nginx - How to redirect users with certain IP to special page

I run quite a big image gallery and there are 5 visitors that create an enormous amount of traffic by downloading the whole site every day using webcopiers. Those visitors have static IPs as it seems. What I would like to achieve is that those 5 IPs…
Alex
  • 391
  • 1
  • 3
  • 6
39
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,183
  • 1
  • 12
  • 20
38
votes
3 answers

When do you have to use quotes in Nginx configuration?

I've seen people use excessive quotes: add_header 'Access-Control-Allow-Origin' '*'; I've seen people use no quotes: add_header Access-Control-Allow-Origin *; Both work fine as far as I know, so when do you actually have to use quotes?
Oliver Salzburg
  • 4,635
  • 17
  • 55
  • 82
38
votes
2 answers

nginx permission denied to certificate files for ssl configuration

I'm installing an nginx ssl proxy on my Fedora server. I've created a cert and key pair under /etc/nginx. They look like this: ls -l /etc/nginx/ total 84 ... -rw-r--r--. 1 root root 1346 Sep 20 12:11 demo.crt -rw-r--r--. 1 root root 1679 Sep 20…
numb3rs1x
  • 513
  • 1
  • 4
  • 6
38
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
  • 381
  • 1
  • 3
  • 3
37
votes
2 answers

How to reverse proxy to different places depending on subdomain in Nginx?

I have multiple subdomains, all pointing to one machine, and one IP address. On this machine, I want to have nginx acting as a reverse proxy, and depending on which subdomain was used to access the machine, I want it to reverse proxy to a different…
markasoftware
  • 489
  • 1
  • 5
  • 7
37
votes
1 answer

nginx catch all other locations than given

I have some locations on my server. I want to catch all other locations which users give via browser. How to to that? For example server { ... location /location1 { do something; } location /location2 { …
alabamajack
  • 475
  • 1
  • 4
  • 5
37
votes
1 answer

Nginx log entries to multiple files

I'd like to log the same access.log entries to separate files, so when a request comes in it should populate a.log and b.log. Is there any way to do this with nginx?
Zoltan Zaikosz
  • 473
  • 1
  • 4
  • 4
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 proxy domain to another domain with no change URL

My question is in the subject. I have a domain, this is the nginx config for it: server { listen 80; server_name connect3.domain.ru www.connect3.domain.ru; access_log /var/log/nginx/connect3.domain.ru.access.log; error_log…
Evgenii Iablokov
  • 660
  • 2
  • 9
  • 15
36
votes
3 answers

nginx + php-fpm - where are my $_GET params?

I have a strange problem here. I just moved from apache + mod_php to nginx + php-fpm. Everything went fine except this one problem. I have a site, let's say example.com. When I access it like example.com?test=get_param $_SERVER['REQUEST_URI'] is…
egis
  • 507
  • 1
  • 4
  • 8
36
votes
9 answers

Nginx + php-fpm "504 Gateway Time-out" error with almost zero load (on a test-server)

After debugging for 6-hours - I am giving this up :| We have a nginx+php-fpm+mysql in LAN with almost 100 wordpress (created and used by different designers/developers all working on test wordpres setup) We are using nginx without any issues from…
rahul286
  • 1,647
  • 5
  • 20
  • 25
35
votes
5 answers

Nginx resolver address from /etc/resolv.conf

Is it possible to set resolver address in nginx proxy configuration from /etc/resolv.conf? It can be useful for example in docker or in virtualenvironment.
Nikolai Golub
  • 480
  • 2
  • 5
  • 10
35
votes
7 answers

getpwnam("www") failed in /etc/nginx/nginx.conf

I copied the nginx.conf sample onto my ubuntu 12.04 box (I don't know where to put the other conf files. I'm an nginx noob). When I try to start nginx I get the following error: abe-lens-laptop@abe:/etc$ sudo service nginx start Starting nginx:…
bernie2436
  • 581
  • 2
  • 6
  • 9