All Questions
Tagged with nginx configuration
480
questions
0
votes
0
answers
49
views
Trying to use HTTPS to multiple host ports
I'm trying to configure Nginx to serve my application on both port 443 and 5501 with SSL. I have the following Nginx configuration:
upstream pixel {
server pixel.example.com:8080 weight=1;
...
0
votes
0
answers
29
views
nginx routes to wrong domain (most of the time)
I have an nginx set up with four domains, including phpMyAdmin; and everything has been working finde until lately. Actually, I found out today, while I was running the updates on the machine (Ubuntu ...
0
votes
1
answer
161
views
host not found in "$server_listen_port" of the "listen" directive
With the following nginx config excerpt:
map $server_name $server_listen_port {
default 443;
localhost. 80;
localhost 80;
}
server {
server_name "${ENVIRONMENT_SERVER_NAME}.&...
0
votes
0
answers
165
views
One nginx config for both local dev and production
I have a website with the following architecture:
Many services running as part of a docker stack
Fronted by single nginx as reverse proxy
nginx does HTTPS termination with certbot
Developed locally ...
0
votes
0
answers
127
views
In NGINX, is there a directive to limit the time it takes to establish new client connections?
In Nginx there's the client_header_timeout directive that sets a timeout for receiving the complete headers of an http request from a client. In the docs it is not specified if this timeout includes ...
0
votes
1
answer
545
views
Make nginx accept requests only from a specific server
I want to configure an nginx server to accept HTTP requests only from a specific server.
I am not sure if this should be accomplished through the listen directive, or by using allow/deny rules in ...
2
votes
2
answers
477
views
How do I configure a virtual server in nginx to listen only on IPv6
For my website I need effectively 3 domains:
example.domain: accessible via both IPv4 & IPv6
ipv4.example.domain: accessible via IPv4 only
ipv6.example.domain: accessible via IPv6 only
I tried ...
0
votes
0
answers
115
views
Nginx Server Block Not Redirecting Properly
I've just recently swapped over to nginx from apache2, and it seems to be handling load times much better. However, I've now lost access to my forum subdomain. Whenever I goto my forum's subdomain, it ...
0
votes
0
answers
218
views
pread() returned only xxx bytes instead of yyy in config file [SOLVED]
I have a little question. I already found a solution, but I want to know the reason for the error.
So, I have a main config file (nginx.conf) that includes vhost configs.
Example hierarchical tree:
├──...
0
votes
1
answer
689
views
"server" directive is not allowed here in /etc/nginx/nginx.conf:1
I have an NGINX docker container with a an nginx.conf file i copy into /etc/nginx/nginx.conf. When i start the container/server, i get the following error:
2023/02/15 16:24:10 [emerg] 1#1: "...
3
votes
2
answers
1k
views
Nginx is not handling auth_request before if statement
It's probably easiest to just show by example where I'm hitting issues, so I'll jump right in...
This snippet will work as-is for Nginx with rewrite/auth modules enabled. So hopefully this issue is ...
1
vote
1
answer
626
views
How to add nginx configurator group?
I want o create a user group that has permissions to create/edit/view nginx configs without sudo permissions, but I heve no idea how.
Creating a normal user group and setting owner:group to same-owner:...
1
vote
1
answer
226
views
NGINX Hosting multiple servers in same domain
I have a website being served by Nginx and I'm trying to do something that I don't know if it's possible the way I'm trying to do but the case is:
I have Application A and B made with React / Node.
...
0
votes
0
answers
85
views
Nginx route based on condition
we are running react service as frontend and nodejs as backend service in docker containers and we are using nginx proxy as a load balancer to serve those containers in feature we are trying to run ...
1
vote
1
answer
422
views
NGINX: localhost redirecting to _
nginx version/1.18.0 (Ubuntu) — Ubuntu 22.04.01 LTS x86_64 kernel 6.0.8
I've got a server (install specs above) that has multiple host names, is running nginx, and everything is working (including ...
0
votes
1
answer
122
views
IP-Filtering on Apache-nginx-Combo
we have the request to secure a domain by restricting access to the ip-ranges of a WAF-Cloud. The server runs Apache for PHP and nginx as reverse-proxy-server, so the chain from browser to website is ...
1
vote
0
answers
158
views
Change "Loaded Configuration File" for a specific domain [Not the entire server]
I do not want to make modifications to the default php.ini the server uses. I've made a new one to use, which is located in my site's own directory on an Nginx server. The issue I have come across is ...
0
votes
1
answer
166
views
Difference between "location /" and Nginx default server block values
What is the point of defining location / { } since, if I understand correctly this will match all potential URIs and "lose" any battle against a location with a more specific URI ?
My ...
0
votes
1
answer
39
views
nginx doesn't properly route to webapp and omitting path
I am currently configuring a nginx reverse proxy. The docker instance of nextcloud is available on Port 8891
server {
listen 8888 ssl http2;
...
location /nextcloud/ {
proxy_pass http://0.0.0....
1
vote
1
answer
5k
views
Vuejs router with Nginx not handling correct routing
I'm developing a VueJS single page application, and for local development I'm using Docker with a docker-compose.yml file to handle an Nginx container for the webserver and a Node container for the ...
0
votes
1
answer
2k
views
Nginx not listening on 443 port (default nginx site)
Problem:
The https://192.168.0.4/ page is not loading and returns (on firefox):
Secure Connection Failed
An error occurred during a connection to 192.168.0.4. PR_END_OF_FILE_ERROR
The page you are ...
1
vote
1
answer
282
views
Nginx ratelimit on ALL files
I set up a ratelimit in my nginx config. Usually you would define a location and define the rate limit zone. I want the zone to apply on ALL files on the web server.
limit_req_zone $binary_remote_addr ...
0
votes
0
answers
2k
views
how force a website to run on port 80 with reverse proxy?
I have a website in a private subnet, which is working on apache 2.4 on port 8090 with reverse proxy to nginx 1.18 on port 80, meaning all static content operating nginx, and all dynamic - apache.
I ...
6
votes
1
answer
4k
views
What does "if in location" context mean in Nginx?
In the Nginx documentation, context for some directives (error_page directive for example) is given as follows:
Context: http, server, location, if in location
My question is, what does "if in ...
0
votes
0
answers
311
views
Nginx: How to rewrite the path to the error page?
I have an /api location that contains an HTTP authorization. I want my 401 page to be displayed on failed authorization.
Here is my file structure (If it's important, I'm running nginx on Windows)
...
1
vote
1
answer
24
views
nginx one site redirects to another
I have couple domains on my server. There is wordpress multisite and vanilla php site. All WP sites are working correctly but if vanilla php site redirects to main WP site. Here is config of main WP ...
0
votes
0
answers
931
views
NGINX - reverse proxy but one subfolder to static local directory
I'm having trouble figuring out the basic syntax for proxying most traffic to a local Solr install but leaving one path/dir requests being sent to a static html directory. Do all secondary, tertiary, ...
1
vote
0
answers
1k
views
nginx proxy_pass change target domain in requests and responses
My Problem is:
I have a server with an internal domain name service.internal.example.com which redirects all clients asking for another domain to its FQDN https://service.internal.example.com. This ...
0
votes
0
answers
2k
views
Why does Nginx only respond on Port 80?
I tried to change nginx' port 80 to 81 in nginx.conf file but my sample site is not responding despite listening to port 81. The sample website only responds on port 80. Also , sample site on http://...
0
votes
1
answer
540
views
Nginx server blocks not redirecting
I am working on a project at https://modernamedia.no/
and I am trying to do a multiple of things
redirect all calls to www.modernamedia.no to https://modernamedia.no/
proxypass localhost:5000 to api....
0
votes
1
answer
440
views
Nginx locations configuration
I have config
location ~ \.(pdf)$ {
expires 2h;
}
location / {
...backend rules...
}
Now I want the first block to be executed only for really existing pdfs, otherwise the request would be ...
0
votes
0
answers
2k
views
100% CPU usage from iowait caused by Nginx, not solved by turning sendfile on and directio off
I run a webservice that performs some basic image processing operations.
The webserver first accepts image uploads from users and temporarily stores them. A backend server then downloads the image ...
2
votes
1
answer
3k
views
Is it possible to set proxy header in NGINX using variable for the *header name*?
According to the NGINX documentation
proxy_set_header field value allows redefining or appending fields to the request header passed to the proxied server. The value can contain text, variables, and ...
1
vote
2
answers
287
views
Prevent Nginx regex rule to override another rule
I have a Nginx server acting as a reverse proxy for a couple services, the config is similar to this one
location /backend/service1 {
proxy_pass http://pathto/service1;
}
location / {
...
0
votes
2
answers
2k
views
Serve nginx's autoindex under different path
I've run into the issue that I would like to enable nginx's autoindex for some directories but those also having their own index files.
So I was wondering if there was a way to make nginx serve it's ...
0
votes
0
answers
315
views
How to define a common location once in NGINX and share it across multiple server blocks?
I have several server blocks, each one corresponds to a different domain. All of them share a common location that has the purpose of renewing SSH certificates (for those familiar with this, it's the ....
0
votes
1
answer
2k
views
Module ngx_http_realip_module and how to set_real_ip_from
I have a very basic question about Module ngx_http_realip_module. I checked the documentation and I saw this example:
set_real_ip_from 192.168.1.0/24;
set_real_ip_from 192.168.2.1;
set_real_ip_from ...
0
votes
0
answers
312
views
Nginx downloads me PHP files instead of executing them
I am using Nginx for my web server, but when I go to a PHP page it downloads it to me.
I realized that my pterodactyl panel (which is in php) was still working, so I used the fastcgi and other parts ...
0
votes
2
answers
240
views
How to make nginx receive and send data to both server1 and server2?
I have nginx as reverse proxy. I want to send data to both server, not just one
not load balancing (just send data that it receive from port 80 to server1 and then server2).
Server1 will be a web ...
0
votes
1
answer
294
views
Nginx not maching url against valid Regex (it looks valid to me and online regex testers)
I'm using npm(Nginx Proxy Manager) to manage my nginx config.
npm has generated this location block:
location ~* ^/docker-compose-ui/?(.*)$ {
set $upstream http://docker_compose_ui:...
0
votes
0
answers
60
views
Nginx Configuration update issue
Previously I was using a domain in my ubuntu VPS server. But currently, I do not want to use the domain in this server. I want to access this server using only IP address in port 80.
My server is ...
3
votes
1
answer
5k
views
Why nginx returns 301 status code when trying to open a directory?
I am trying to understand how Nginx works. Now I'm working on index and try_files directives. My config file is this:
events {}
http {
rewrite_log on;
error_log /var/log/nginx/localhost.error_log ...
0
votes
1
answer
817
views
nginx location directive does not return http status
Note: I have read through the several Q/A's on SO, ServerFault, etc... but none of the answer seem to be working.
Running an AWS ec2 Ubuntu (v20.04) web server with a basic nginx (v1.18) config. ...
0
votes
1
answer
338
views
Nginx- Setting up Firewall Bypass Prevention
I would like to Set up Firewall Bypass Prevention in my Nginx. To do so, I want to add the following directive to Nginx configuration:
location / {
allow xxx.xx.xxx.x/xx;
allow xxx.xx.xxx.x/xx;...
2
votes
1
answer
403
views
nginx redirect or return single location
I am trying to get videos.mydomain.com/kickboxing to redirect to a YouTube link, as well as videos.mydomain.com/classes to redirect to a different YouTube link. (These are both unlisted playlists, and ...
0
votes
0
answers
77
views
Extra trailing slash when re-directing www to non-www
This is my current configuration:
server {
if ($host = www.mywebsite.com) {
return 301 https://mywebsite.com$request_uri;
} # managed by Certbot
if ($host = mywebsite.com) {
...
1
vote
0
answers
52
views
nginx slows down my rest-service by 5x
I have a simple REST service set up that natively (standalone executable) handles 135k/rps.
Service is running on localhost:8181
autocannon benchmark running from separate machine yields:
┌───────────┬...
0
votes
1
answer
154
views
Nginx not captures regex variables
Trying to capture URLs like http://mydomain/1234567890123 (13 digits)
location ~ ^/([\d]{13})$ {
proxy_pass http://127.0.0.1:4000/product?id=$1;
}
$1 variable arriving empty, ...
1
vote
1
answer
1k
views
try_files doesn't use variables from regex and map
I'm trying to conditionally serve .webp images to supported clients. The images are stored like image.jpg and image.jpg.webp in the same folder.
I can't get try_files to do what I think it should to. ...
-1
votes
1
answer
932
views
Setting up a catchall with NGINX
I'm having a problem with my nginx server configuration. The current behavior is that if a domain can't be found in any of the configuration files, it will redirect to a random other configuration. ...