Questions tagged [nginx]
nginx (pronounced “engine x”) is a lightweight web server and a reverse proxy server
1,044
questions
32
votes
5
answers
72k
views
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 ...
30
votes
4
answers
42k
views
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 ...
28
votes
2
answers
49k
views
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
27
votes
2
answers
75k
views
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 ...
26
votes
2
answers
26k
views
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 ...
24
votes
2
answers
55k
views
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
25k
views
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 ...
23
votes
9
answers
44k
views
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 ...
19
votes
1
answer
16k
views
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;
...
18
votes
2
answers
29k
views
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 ...
17
votes
2
answers
39k
views
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 ...
16
votes
3
answers
60k
views
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?
16
votes
1
answer
10k
views
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 ...
15
votes
3
answers
32k
views
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-...
15
votes
3
answers
21k
views
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] ...
14
votes
1
answer
34k
views
Nginx: Serve static files out of a given directory - one level too deep
I'm pretty new to nginx configs. I'm having some difficulty with a pretty basic problem. I'd like to host some static files at /doc (index.html, some images, etc). The files are located in a directory ...
13
votes
6
answers
36k
views
How to remove double slash in URLs served by nginx?
I need to replicate the following Apache rewrite rules in Nginx config on Ubuntu 12.04. What is the nginx equivalent to :
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
10
votes
5
answers
62k
views
Homebrew does not completely uninstall nginx
I installed yesterday nginx on my machine using
brew install nginx
Today I would like to remove the software, therefore I tried
brew uninstall nginx
which has been correctely executed. In fact if ...
10
votes
5
answers
13k
views
Mac firewall blocking nginx (port 80) from external side
I installed nginx using ports and started it with sudo. Accessing the nginx welcome page from localhost works perfectly, however accessing it from an external computer fails.
Doing an nmap on the ...
10
votes
2
answers
41k
views
nginx doesn't log anything
I'm running a FreeBSD 9-Stable server, with nginx.
My configuration is here:
user www www;
worker_processes 5;
error_log /var/log/nginx/nginx-error.log;
events {
worker_connections 1024;
}
http {
...
9
votes
4
answers
23k
views
Check to see if NGINX is installed on UBUNTU
Is there any or command to check whether NGINX is already installed on UBUNTU Linux using a bash command/script?
I was trying something like this
echo "BEGINNING INSTALLATION OF NGINX WEB SERVER"
...
9
votes
1
answer
6k
views
Why can't nginx access puma socket on CentOS 7?
So I have a Ruby on Rails app in /var/www/ owned by nginx with 755 permissions. Said app is intended to be deployed via puma.
Like so:
rvmsudo -u nginx bundle exec puma -e production -d -b unix:///...
9
votes
1
answer
39k
views
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate
I ran these two commands separately:
openssl dhparam -dsaparam -out ./certs/dhparam.pem 4096
openssl req -x509 -nodes \
-days 965 -newkey rsa:2048 \
-keyout ./certs/nginx-selfsigned.key -out ./...
9
votes
3
answers
28k
views
Why a listen 443 default_server; nginx rule override already configured rule (http rules working normal way)?
I have an nginx and different subdomains:
a.mydomain.com
b.mydomain.com
c.mydomain.com
Nginx has 4 rules:
1) rewrite rule:
server {
listen 80
server_name gl.udesk.org;
root /nowhere;
...
9
votes
0
answers
3k
views
Trying to remove 1152 samples, but the queue is empty
I am streaming mp3 files,using this command :
ffmpeg -re -i 'INPUT.mp3' -map_metadata -1 -map 0:0 URL
I create a loop which stream files,and there is no problem with reviving stream,just from server ...
8
votes
1
answer
38k
views
How can I setup a UDP NGINX reverse proxy, and how does it work?
I have read the documentation on NGINX's UDP/TCP reverse proxy, but I am a little confused. Does NGINX need to be on both the proxy server, and the server that the proxy will forward too?
My ...
8
votes
3
answers
9k
views
I can't open phpMyAdmin, get error 301 or 500
I've installed phpMyAdmin, but I can't open it on any browser: I get a 301 redirect(*) if I browse to http://localhost:8080/phpmyadmin. If I add a / to the end of the addres, I get a 500 error status ...
7
votes
2
answers
26k
views
nginx -v command not found
I successfully installed nginx ~ but when I use nginx -v command, it show : nginx: command not found
what the problem?
7
votes
1
answer
16k
views
Host .p7b HTTPS certificate in nginX
We have a requirement to change webservices from HTTP to HTTPS, so we generated .csr and provided to our client and got back .p7b and .cer files in return to use them in nginX hosted on linux server.
...
7
votes
1
answer
20k
views
How to serve static html from arbitrary url path in nginx?
I would like to serve example.com/mypage.html from example.com/mypage.
Within nginx.conf I tried putting mypage.html in designated root directory and then
location /mypage}
alias mypage.html;
}
...
7
votes
1
answer
5k
views
How do I use allow/deny in conjunction with set_real_ip_from?
My nginx backend server should only accept requests from my frontend, 1.2.3.4. However, I also want nginx to log the correct IP address, so I use set_real_ip_from. But by doing this, the allow rule in ...
7
votes
2
answers
28k
views
How to run python script via nginx?
nginx is able to run php scripts to generate content for it to serve.
How can you get nginx to execute an arbitrary program, say, a python script, and have it serve up the output?
6
votes
2
answers
10k
views
How to troubleshoot Upstart Unknown job error
I set up nginx according to instructions here and it all went well but I am unable to start with
$ start <my app name>
I created /etc/init/nomilkfor.me.conf (this is the domain name) and this ...
6
votes
2
answers
3k
views
What's the reasoning for nginx defaulting to error 503 when a rate limit applies instead of error 429?
The documentation says:
nginx.ingress.kubernetes.io/limit-connections: number of concurrent connections allowed from a single IP address. A 503 error is returned when exceeding this limit.
nginx....
6
votes
1
answer
25k
views
Make nginx reverse proxy 302 redirect to a URI sub-folder instead of root
I have a web server on my LAN with the URL https://10.0.0.22 and I am trying to access it from the internet through an nginx reverse proxy with a URL like https://domain.com/my/web/app.
The ...
6
votes
4
answers
17k
views
Can’t get Nginx to work on port 80. Works fine on any other port
I’ve just setup Homebrew’s Nginx on Mac OS X 10.11 (El Capitan).
If I set my Ngnix config like this:
listen 127.0.0.1:8080;
listen 127.0.0.1:81;
listen 127.0.0.1:75;
It’ll work. ...
5
votes
3
answers
23k
views
can't access website by ip but I can access by fully qualified domain
So it seems I can't browse a website by IP, but I can browse using it's hostname.
C:\Users\c>nslookup www.example.com
Non-authoritative answer:
Name: cx-cdn-bre.gss.consultix.net
Addresses: 62....
5
votes
2
answers
7k
views
Running server on home network with HTTPS
Like the title suggests, I am trying to configure my server to serve traffic with HTTPS. I am already able to expose the server and receive information from it, just simply without HTTPS.
There are a ...
5
votes
1
answer
6k
views
Cannot install Nginx on AWS EC2 AMI2 - Topic :topic: is not found
I would like to install Nginx as a reverse proxy on my AWS EC2 (OS: AMI2) instance.
When I try to install nginx, I get told that nginx is available in Amazon Linux Extra topics...
sudo yum install ...
5
votes
1
answer
8k
views
How to allow specific SSL client certificates in Nginx?
Nginx's ssl_client_certificate and ssl_trusted_certificate directives can be used to allow client certificates signed by a given authority. But how can I allow specific certificates? I would like to ...
5
votes
3
answers
20k
views
unable to connect to localhost:80 after installing nginx
I just installed nginx by doing sudo yum install nginx and I'm unable to connect to it on port 80.
I tried stopping iptables by doing sudo service iptables start and was still unable to connect.
I'm ...
5
votes
2
answers
34k
views
Ftp proxy using nginx
I'm trying to set-up a simple ftp proxy using Nginx. Right now my configuration is like this:
server {
listen 21;
server_name 52.49.13.91;
location / {
proxy_pass ftp://my.ftpsite....
5
votes
1
answer
10k
views
Nginx can't find PCRE library on Ubuntu Server
I have been trying to get a Passenger and Nginx setup to work with php files but I am having problems with the PCRE regular expressions library. Install all went fine so I'm assuming it found the ...
5
votes
1
answer
7k
views
Subversion over https + WebDAV on nginx
I wonder how do I create SVN repo and let users access it over http[s] + WebDAV on nginx
I did not find any good tutorials describing this process whilst there are a lot of answers on this scheme but ...
5
votes
0
answers
3k
views
Nginx proxy_pass when http referer contains a string? [closed]
I test the config below, not work. How to make it?
http {
server {
location / {
if ($http_referer ~* /.*/flee.*/) {
proxy_pass http://127.0.0.1:8765;
...
4
votes
2
answers
9k
views
How can I disable nginx from Gitlab bunlde?
I've installed a Debian/Jessie server with an apache 2.4 service
I downloaded and installed the bundle package of Gitlab for Debian 8
(Jessie)
I activate unicorn and configure a virtualhost in apache ...
4
votes
1
answer
8k
views
nginx : HTTP/2 switch to HTTP/1.1 (testing)
For testing purpose, I have been trying to switch my nginx server back to HTTP/1.1. I've been using HTTP/2 since it was first available (release 1.9.5).
According to the documentation and this ...
4
votes
2
answers
14k
views
nginx-rtmp pushing from one application to another
I'm trying to push a RTMP stream with the nginx-rtmp-module (set up after this manual) from one of its applications into another one. A minimal example of my config (nginx.conf) looks as following.
...
4
votes
1
answer
4k
views
ElasticBeanstalk auto scaling causes 502 Bad Gateway
We're using AWS ElasticBeanstalk to serve our Ruby on Rails application and have recently enabled auto scaling. The auto scaling works as expected but there is a brief period of time where ...
4
votes
2
answers
11k
views
NginX+PHP-FPM setup: Why is this configuration workaround needed to properly set PATH_INFO? [Debian7.4]
It took several hours to find out how to properly configure NginX, but I still think I might have missed something. Mainly because this perfectly working setup raises more questions than it answers. ...