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
33
votes
4 answers

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?
Quintin Par
  • 4,373
  • 11
  • 49
  • 72
32
votes
2 answers

nginx: [emerg] "stream" directive is not allowed here

I have the latest NGINX from ppa installed on Ubuntu 16.04. nginx version: nginx/1.12.1 From my understanding, it should support stream and UDP load balancing. But I get this error message: nginx: [emerg] "stream" directive is not allowed here in…
Houman
  • 1,545
  • 4
  • 22
  • 36
32
votes
5 answers

What are the performance implications for millions of files in a modern file system?

Let's say we're using ext4 (with dir_index enabled) to host around 3M files (with an average of 750KB size) and we need to decide what folder scheme we're going to use. In the first solution, we apply a hash function to the file and use two levels…
Leandro Moreira
  • 549
  • 1
  • 7
  • 13
32
votes
5 answers

Nginx disable .htaccess and hidden files but allow .well-known directory

I have a Nginx server, and disabled hidden files in the nginx_vhost.conf ## Disable .htaccess and other hidden files location ~ /\. { deny all; access_log off; log_not_found off; } But LetsEncrypt needs access to the…
Janghou
  • 475
  • 1
  • 4
  • 7
32
votes
7 answers

Redirect non-www to www over SSL with Nginx

I'm having an error when trying to redirect https://example.com to https://www.example.com. When I go to https://example.com, it doesn't redirect and returns the page/200 status. I don't want this, I want it to redirect to…
Thomas V.
  • 2,071
  • 2
  • 17
  • 13
32
votes
2 answers

Difference between ca-bundle.crt and ca-bundle.trust.crt

On CentOS 6.5, in /etc/pki/tls/certs I have: ca-bundle.crt and ca-bundle.trust.crt With different file sizes. Which should I use as the trust path for nginx proxy_ssl_trusted_certificate.
Justin
  • 5,328
  • 19
  • 64
  • 84
32
votes
3 answers

nginx: bind() to 0.0.0.0:80 failed on Windows

I've been using nginx without any problem on windows for the last few months. Today when I tried to start it up, I got this error: nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its…
Dean Rather
  • 1,100
  • 1
  • 13
  • 18
32
votes
5 answers

Nginx set_real_ip_from AWS ELB load balancer address

I have a set of Nginx servers behind an Amazon ELB load balancer. I am using set_real_ip (from the HttpRealIpModule) so that I can access the originating client IP address on these servers (for passing through to php-fpm and for use in the…
vitch
  • 630
  • 2
  • 8
  • 10
32
votes
2 answers

Nginx proxy_read_timeout vs. proxy_connect_timeout

I've started using Nginx as a reverse proxy for a set of servers that provide some sort of service. The service can be rather slow at times (its running on Java and the JVM sometimes gets stuck in "full garbage collection" that may take several…
Guss
  • 2,670
  • 5
  • 34
  • 59
32
votes
2 answers

Nginx Config: Front-End Reverse Proxy to Another Port

I have a small web server that serves requests on port 5010 rather than 80. I would like to use nginx as a front end proxy to receive requests on port 80 and then let those requests be handle by port 5010. I have installed nginx successfully and it…
Ted Karmel
  • 423
  • 1
  • 4
  • 4
31
votes
3 answers

unknown directive "stream" in /etc/nginx/nginx.conf:86

I have nginx/1.12.0 and as per document it contains stream module. I have installed nginx with the following commands. sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo apt-get install nginx nginx -v nginx version: nginx/1.12.0 I…
user3332404
  • 411
  • 1
  • 4
  • 7
31
votes
2 answers

Nginx wildcard/regex in location path

The Nginx config I have throws 404 for .php like: ## Any other attempt to access PHP files returns a 404. location ~* ^.+\.php$ { return 404; } However I have some index.php file in subfolder that I want to run. The current config is…
user156477
31
votes
1 answer

Which permissions should I set to dhparam.pem?

I am generating Diffie-Hellman parameters for the ssl_dhparam directive in the SSL configuration of nginx. The file dhparam.pem is created with the command openssl dhparam 2048 -check -out dhparam.pem. Which permissions should I set to this file? Is…
Eric Bréchemier
  • 1,435
  • 2
  • 12
  • 8
31
votes
1 answer

How can I let nginx log the used SSL/TLS protocol and ciphersuite?

My goal is to ensure proper security for clients connecting to my nginx. I'm following Mozilla's guide to configure TLS properly on my nginx installation, but I don't have an overview of the actual protocols/ciphersuites being used in practice. What…
gertvdijk
  • 3,504
  • 4
  • 30
  • 46
31
votes
5 answers

How do I specify Windows file paths in nginx

I'm using the official windows version of nginx. I want to specify the windows equivalent of this configuration location /static/ { alias /home/user/staticfiles/; } How do I specify windows file paths in the alias directive? Is this even…
Vasil
  • 495
  • 1
  • 4
  • 7