Questions tagged [nginx]

nginx (pronounced “engine x”) is a lightweight web server and a reverse proxy server

About

Nginx is a high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. The project started in 2002 and became public in 2004. Nowadays it powers several high-visibility sites, such as Netflix, Hulu, Pinterest, CloudFlare, Airbnb, WordPress.com, GitHub, SoundCloud, Zynga, Eventbrite, Zappos, Media Temple, Heroku, RightScale, Engine Yard and NetDNA.

Nnginx has been a free open source software since the beginning with its sources licensed under 2-clause BSD-like license.

Links

1064 questions
33
votes
5 answers

Nginx as forward proxy for HTTPS

While I was able to successfully configure nginx to proxy HTTP traffic (using this guide), all attempts to proxy HTTPS requests resulted in code 400 (Bad Request). Nginx debug logs weren't helpful at all: 2013/06/05 14:38:33 [info] 74946#0: *589 …
katspaugh
30
votes
4 answers

how to reload nginx - systemctl or nginx -s?

Is there a difference between calling systemctl reload nginx and calling nginx -s reload ? I know that, besides systemd, there are other init systems like SysV and Upstart. So maybe this question applies to them too. Is it preferable to issue this…
moonring
  • 301
28
votes
2 answers

Nginx rewrite rule to remove path node

Let's say a user tries to access a given image on my website using the following url: http://www.mywebsite.com/blog/image1.jpg?someParam=100 i need a rewrite rule to this, removing the 'blog' node from the…
28
votes
2 answers

How do erase the contents of a error.log file but keep the file intact

I want to erase the contents of the file error.log (nginx error log file), but I don't want to actually delete the file. is this possible? running ubuntu
user27449
  • 7,178
26
votes
2 answers

Why does the percent sign in a URL cause an HTTP 400 Bad Request error?

I stumbled upon this by accident when mistyping the URL for a web page in my web browser. Why does visiting http://example.com/% cause an HTTP 400 Bad Request error to be thrown? Is the server expecting something else after or before the percent…
iglvzx
  • 23,818
25
votes
2 answers

Permissions for SSL key?

I'm trying to set up a secure connection (https) in nginx. But I'm a bit worried about the private key's permissions, which aren't mentioned in any tutorial. Should I change them? To what?
24
votes
5 answers

How do I start nginx on port 80 at OS X login?

I installed Nginx using homebrew and after completing the installation the following message was displayed: In the interest of allowing you to run `nginx` without `sudo`, the default port is set to localhost:8080. If you want to host pages on your…
Bryson
  • 431
24
votes
9 answers

Can nginx serve SSH and HTTP(S) at the same time on the same port?

Context I have a personal server that I use for the web. I sometimes need to SSH/SFTP to it. Disclamer: I have very little experience with nginx internals. Problem This morning, I figured out that the free wifi in a well-know cafe chain was…
JohnW
  • 377
20
votes
2 answers

Configuring nginx to retry a single upstream server

I'm using nginx as a reverse proxy and I would like it to wait some number of seconds and retry a request if the upstream server isn't responding. This way I can restart my upstream server and instead of users seeing 502 bad gateway, their browsers…
John
  • 301
19
votes
1 answer

Nginx serves site even if server_name does not match

This is my nginx configuration (running as docker container, in case it matters): events { worker_connections 4096; ## Default: 1024 } http { server { server_name registry.mydomain; listen 80; listen 443 ssl; …
blueFast
  • 2,876
17
votes
2 answers

How to make nginx rewrite URIs in HTTP body content?

This is a follow-on to my earlier question on how to Make nginx reverse proxy 302 redirect to a URI sub-folder instead of root. I have an nginx proxy server that uses the rewrite and proxy_pass directives to proxy external requests to a URL like…
Steve HHH
  • 7,430
16
votes
3 answers

How to I get variables from location in nginx?

The location from nginx conf: location ~/photos/resize/(\d+)/(\d+) { # Here var1=(\d+), var2=(\d+) } How to I get variables from location in nginx?
satels
  • 282
16
votes
1 answer

Metallb vs Nginx Ingress in Kubernetes

From what I understand, Metallb is a load balancer that assigns IP address to a service, which can be exposed to the outside world. Nginx Ingress is just like normal nginx, but it resides in kubernetes and provides routing to different routes. My…
16
votes
3 answers

Get Nginx to always serve index

How can I get nginx to always serve index.html no matter the URL? For example, I want the URL https://www.example.me/723738 to always serve https://www.example.me/index.html I don't want to use a re-direct, because the user must still have the…
Cherona
  • 443
15
votes
3 answers

can't run nginx in alpine linux (docker)

Well I have set up an alpine linux docker container with nginx on it (apk add nginx) Now I am trying to run nginx. With the simple command nginx This returns the following error: nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file…
paul23
  • 593
1
2 3
70 71