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.
1,066
questions
8
votes
4
answers
20k
views
nginx subdomain rewrite
Yet another nginx rewrite rule question
How can I do a rewrite from http://www.*.domain.com to http://*.domain.com ?
thanks in advance
-- Deb
EDIT:
I'm sorry I didn't see the textile formatting ...
7
votes
4
answers
4k
views
Experience in migrating from Apache to nginx?
I'd like to get some feedback about a migration From Apache to nginx. My goal is to reduce the memory footprint of the web server. Currently, I use the following modules.features on Apache:
multiple ...
7
votes
2
answers
19k
views
NGINX is giving 404 errors on all but the HTML pages
I setup nginx as a reverse proxy in a docker container to link to sites outside of the container. I have a vhost config setup as follows (I tried adding the ^~ before the location for home-assistant):...
7
votes
1
answer
4k
views
fastcgi_cache_valid vs. fastcgi_cache_path "inactive" parameter?
If I've config
fastcgi_cache_path /opt/nginx levels=1:2 keys_zone=TEST:100m inactive=40m;
..
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_cache_valid 30m;
How long will my cache ...
7
votes
3
answers
4k
views
Could this server log mean my server is being used as a proxy?
I came across the following entry in my access.log:
58.218.199.147 - - [05/Jun/2012:12:56:04 +1000] "GET http://proxyproxys.com/ HTTP/1.1" 200 183 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5....
7
votes
1
answer
9k
views
Can't access https despite port 443 is opened
This is my first time setting up a server and I've just installed a SSL cert. I have also made some changes to the iptable to allow access to 443. Below is the output of iptables -L
target prot ...
7
votes
2
answers
15k
views
Force Nginx to send Content-Length header for static files with gzip?
We're running Nginx 0.7.65[-1ubuntu2.3]. I've just noticed that when serving local static files using an alias directive and gzip on, the Content-Length header is not getting sent. Since it's serving ...
7
votes
2
answers
22k
views
How to use nginx PAM module?
I would like to use nginx PAM module to authenticate a site with existing users on a FreeBSD system. I tried to use pam_unix.so, but no luck. It's just not let me in with my usr/psw pair. :(
nginx ...
6
votes
3
answers
14k
views
Block HTTP 1.0 with nginx
My server is under a heavy attack. Most requests are coming this way:
46.43.84.214 - - [15/May/2012:11:21:45 +0400] "GET / HTTP/1.0" 200 65859 "2r4k68998q24ay.ru" "Mozilla/4.0 (compatible; MSIE 4.01; ...
6
votes
3
answers
7k
views
Using Nginx to Block Connections that aren't addressed to my domain
I am running a django app on AWS elastic beanstalk and I'm getting spammed by bots trying to scan for vulnerabilities. It results in a flood of errors such as:
(Where xx.xxx.xx.xx is my ec2 instance's ...
6
votes
2
answers
7k
views
Nginx: Bypass rate limiting with header
This answer is perfect dealing with bypassing rate limiting with IP addresses.
If I need to bypass rate limiting with a secret header, how do I achieve this?
Ref:
http {
geo $whitelist {
...
6
votes
3
answers
14k
views
How to use FastCGI globally and Basic Auth in sublocations in nginx?
I recently deployed my first nginx setup and everything works really nice, except the location parsing is driving me nuts. I have a simple php fastcgi setup like this:
location ~ \.php {
if (!-e $...
6
votes
5
answers
10k
views
Modify Nginx 301 response body
So, when doing curl -i http://example.com on my server, I get this response in body:
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">...
6
votes
2
answers
9k
views
How to get Nginx to support the HTTP OPTIONS method
I have an Nginx server this is returning a 403 when a client uses the HTTP OPTIONS method. It sounds like Nginx does not support the OPTIONS method, but I couldn't find conclusive evidence of this on ...
6
votes
1
answer
12k
views
why Chrome browser doesn't recognize my nginx http2 server?
I setup my Nginx conf as per Digital Ocean paper,
and now http2 is available...
But in Chrome (Version 54.0.2840.98 (64-bit)) Dev tool, it's always on HTTP 1/1 :
NAME METHOD STATUS ...
6
votes
1
answer
11k
views
nginx and php-fpm "Primary script unknown"
Smells like a duplicate, I know, but I have now tried this Setup 5 Times over, and still I can't get this to work. Most of the configs are complicated with chroot and multi servers etc., but I have ...
6
votes
1
answer
21k
views
How to deny POST to a url in nginx
Some of the SQL-heavy URL on my app (say /members) are being attacked by botnets. So I'd like to disable anybody to post to these URL, while allowing others to GET them.
I tried to make a nested ...
6
votes
1
answer
10k
views
nginx does not respond correctly to HTTP/1.1
I'm having an issue where certain clients that first try to connect via HTTP/1.1 are not correctly getting forwarded to HTTPS
curl -v http://indentationerror.com/
* Trying 217.45.175.173:80...
* ...
5
votes
2
answers
995
views
How do I get nginx to issue 301 requests to HTTPS location, when SSL handled by a load-balancer?
I've noticed that there's functionality enabled in nginx by default, whereby a url request without a trailing slash for a directory which exists in the filesystem automatically has a slash added ...
5
votes
2
answers
7k
views
Nginx (for static files) and Apache (for dynamic content)?
So, my entire application runs on apache just fine. However, I want to test how much the requests per second increases if I put all static files through nginx instead.
I found this thread:
https://...
5
votes
2
answers
21k
views
nginx as reverse proxy with several domains & hosts
This question has probably been asked several times, but with all results I can find and my little knowledge, I'm kind of lost. I'm using Fedora 29.
What I try to do with nginx :
Use one let's ...
5
votes
1
answer
12k
views
nginx: understanding the purpose of auth_http (IMAP proxy)
I would like to send IMAP client requests to an IMAP back-end via an nginx proxy. According to the the mail_auth_http module, a directive auth_http has to be used in order to authenticate the clients. ...
5
votes
1
answer
5k
views
Basic auth only if a certain header is present in the request?
Q: I want to be able to enable basic authentication for only those requests, that include a specific header in the request.
Use case: Ask authentication for only certain clients whose requests are ...
5
votes
1
answer
21k
views
Set max_fails and fail_timeout for all servers in upstream in nginx
All of the examples I've seen of using upstream (for load balancing) in nginx look like this:
upstream backend {
server backend1.example.com:8080 max_fails=3 fail_timeout=30s;
...
5
votes
1
answer
10k
views
nginx: gzip on server is lost during proxy
Using nginx as a reverse proxy/load balancer in front of iis/.NET application servers.
Our servers are configured to gzip response payloads. Works fine.
When we stick gzip in front, responses are no ...
5
votes
6
answers
10k
views
Apache, nginx, or lighttpd? [closed]
I am going to be live blogging from an event and expect huge spikes in traffic. I am currently using apache with modphp and it died last year under heavy traffic and I don't want it to happen again.
...
5
votes
4
answers
19k
views
Alias using Nginx causing phpMyAdmin login endless loop
Recently I've been trying to set up a web server using Nginx (I normally use Apache). However I've ran into a problem trying to set phpMyAdmin up on an alias. The alias correctly takes you too the ...
4
votes
2
answers
5k
views
Apache-style multiviews with Nginx
I'm interested in switching from Apache/mod_php to Nginx for some non-CMS sites I'm running. The sites in question are either completely static HTML files or simple PHP, but the one thing they have in ...
4
votes
2
answers
10k
views
How to redirect http requests to https (nginx)
There appear to be many questions and guides out there that instruct how to setup nginx to redirect http requests to https. Many are outdated, or just flat out wrong.
# MANAGED BY PUPPET
upstream ...
4
votes
2
answers
11k
views
Clean URLs and php extension on nginx
I've looked at dozens of other questions and references on the web - and by all my calculations, my setup should work, but it doesn't.
I have nginx installation with php-fpm. If I try to access a ....
4
votes
1
answer
4k
views
Rewriting ASCII-percent-encoded locations to their UTF-8 encoded equivalent
For example, “å” can be encoded as /%E5 and /%C3%A5 (utf-8). All my filenames are UTF-8, so the ASCII variants return a 404. I want both variants to work.
I have tried rewriting the incorrect URLs to ...
4
votes
3
answers
3k
views
Nginx sslv3 poodle disable
I tried setup SSL cert without SSLv3 in my nginx, but SSL Labs say, my server have SSLv3 how to disable it.
My config:
add_header Strict-Transport-Security max-age=31536000;
add_header X-...
4
votes
2
answers
4k
views
How do I reserve bandwidth for rsync?
Currently nginx uses all my bandwidth. How do I leave some for rsync?
4
votes
1
answer
13k
views
Nginx rewrite rule (subdirectory to subdomain)
I would like to redirect admin subdirectory to a subdomain. I tried to create this rule for Nginx however it's not working:
location ^~ /admin/ {
rewrite ^/admin(.*) http://admin.example.com$...
4
votes
2
answers
3k
views
Nginx as reverse proxy for GitLab with SSL?
I have GitLab's nginx setup to listen at 127.0.0.1:8088 . Then I have a system nginx (installed via apt-get on Ubuntu) setup as reverse proxy with HTTPS:
upstream gitlab {
server ...
4
votes
2
answers
7k
views
nginx using resolver in a stream
I am trying to use nginx to pass an incoming connection to another server (the reason I am doing this -- the connection is coming in from a host that can't do DNS resolution, and the server that ...
4
votes
2
answers
20k
views
Hide port in Nginx reverse proxy redirection
My set up is as follows:
Webserver: app listening on port 8529.
Reverse proxy: Nginx listening on port 80.
The problem is that my Nginx redirects requests to port 8529 and this appears in the URL ...
4
votes
2
answers
5k
views
Requests per second slower when using nginx for load balancing
I've set up nginx as a load balancer that reverse proxies requests to 2 Apache servers. I've benchmarked the setup with ab and am getting approx 35 requests per second with requests distributed ...
4
votes
1
answer
6k
views
nginx map directive not working with subnet masks
Is there something special needed to match subnets in nginx when using map? I have the below configuration in the http {} block. The client IP is 10.0.3.1. If i remove the 10.0.3.1 entry it always ...
4
votes
1
answer
2k
views
Redirect all subdomains to main domain with HTTPS without a wildcard cert (nginx)
I have a domain name with a main site and a few vhosts. I want all sites (main and vhosts) to only be accessible through HTTPS (using HSTS), and I want non-existing subdomains to be redirected to the ...
4
votes
2
answers
968
views
How to host CouchDB with Fauxton at a non-root location using Nginx as reverse proxy
CouchDB is bundled with a version of Fauxton that has a critical bug that prevents Fauxton from working if CouchDB is hosted at a non-root location. So if you want to host CouchDB at /couchdb, then ...
3
votes
0
answers
8k
views
nginx as smtp proxy [closed]
I was ordered to configure nginx as SMTP proxy. That's all details I have. I've looked though some books and docs and don't see neither any examples of such configuration nor explanations of why this ...
3
votes
3
answers
2k
views
SSL wildcard certificates and "www" sub-subdomains
I've got a wildcard SSL certificate for *.example.com.
I'm using Nginx, and redirecting all traffic for HTTP to HTTPS, and also rewriting the URLs to remove a www subdomain (if there is one).
So it ...
3
votes
1
answer
13k
views
Nginx server responds to ip but not domain name
I have a server with nginx setup. I want it to respond to the domain testhero.in.th.
So in the config file, in my server block, I set server_name testhero.in.th.
I try to access the site through ...
3
votes
3
answers
10k
views
cakephp & nginx config/rewrite rules
Hi somebody please help me out, I've asked this at stackoverflow as well but not got much of a response and was debating whether it was programming or server related.
I’m trying to setup a cakephp ...
3
votes
2
answers
11k
views
Nginx location exact match matches beyond arguement
In my nginx config, I would like to catch /foo-bar/ and do a rewrite using location, but for it to ignore /foo-bar/anything-else.
I've tried:
location = /foo-bar/ {
and
location ~ ^/foo-bar/$ {
and
...
3
votes
3
answers
7k
views
how to prevent image hotlinking in nginx?
I am trying to implement image hotlink protection problem in nginx and I need help. I have a huge issue of my site's images being submitted to social networks like StumbleUpon with a direct link like
...
3
votes
2
answers
8k
views
Unable to use LetsEncrypt - CertBot - When HTTP to HTTPS redirect is setup
I am trying to configure CertBot and it only works when I serve my site over http. Usually I have an https redirect and I don't want to have to change the site config each time I need to use certbot. ...
3
votes
2
answers
7k
views
Is it possible to balance load between multiple Nginx load balancers without using a hardware load balancer?
I plan to balance load between my app servers using a separate Nginx server as a software load balancer. But actually, it's because a load balancer in front of the app servers allows me to update an ...
3
votes
2
answers
8k
views
Why is my Nginx location rule not taking precedence?
I have a PHP application (Wordpress) in the root folder of my site, and all requests to the site run through it happily.
However, I have a subfolder, _links, which I would like to use to execute ...