Questions related to nginx location directive should use this tag.
Questions tagged [nginx-location]
1424 questions
3
votes
2 answers
Unable to map upstream with folder in nginx server
I want to map our system port 82 with 127.0.0.1:8080/runningSite and I am gettting exception with nginx config.
upstream dev {
server 127.0.0.1:8080/runningSite;
}
server {
rewrite_log on;
listen [::]:81;
server_name localhost;
…

Charnjeet Singh
- 3,056
- 6
- 35
- 65
3
votes
3 answers
how does an exact location match work in nginx?
In the code below, the index directive adds page1.htm to / requests. So I would expect an exact match for http://DOMAIN to be matched by the 2nd location block and not the first.
index page1.htm;
location = /
{
rewrite / /page2.htm;
…

poby
- 1,572
- 15
- 39
3
votes
1 answer
Nginx - Changing the server root make location root not working
I'm trying to setup phpmyadmin on my domain, and for some reason, I can't have the server root I want.
This doesn't work (404 on example.com/phpmyadmin without anything in the logs):
server {
listen 80 default_server;
listen [::]:80…

Bug8
- 63
- 1
- 1
- 4
3
votes
1 answer
Using regex matches from nginx location in try_files directive
I have the following location blocks in a nginx server block config:
location /eci-new/public {
try_files $uri $uri/ /eci-new/public/index.php?$query_string;
}
location /eci-integration/public {
try_files $uri $uri/…

Lu32
- 810
- 1
- 9
- 18
2
votes
2 answers
Nginx: access upstream response header in the mirror block
My mirroring works just fine, and I am correctly getting the original request body in the mirror server.
However I need to access a response header called Location from the original upstream and forward it to my mirror. Typically the response header…

Shaunak
- 17,377
- 5
- 53
- 84
2
votes
0 answers
Nginx Rewrite Querystring to Path with file
I am creating a rule for S3, with Rewrite Querystring to Path with file
Requests from the browser to the server can be
http://localhost:8088/bucket-media/1111111_0.jpg?size=large
"size" is a directory in the s3 bucket, it needs to be proxied to…

s2nner
- 23
- 1
- 3
2
votes
0 answers
nginx authelia-authrequest.conf for subnet
I'm posting this topic because I have a problem with nginx configuration on authelia with ip filtering.
Here is my current configuration.
####BABBYBUDDY####
map $remote_addr $is_allowed {
192.168.1.120 1;
default 0;
…

focheur91300
- 21
- 1
2
votes
1 answer
nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored
I have three nginx server blocks and when i run nginx -t get error "nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored"
I have three nginx server blocks:
One: /etc/nginx/sites-available/default
server {
listen 80…

James Son
- 93
- 1
- 6
2
votes
1 answer
NGINX Only path equals to without trailing slash and starts with path with trailing slash
I'm encountering an annoying error when it comes to my current NGINX app configuration.
I have a static web app which I am indexing on the path /admin/*. I want the index to be available on /admin, with and without a trailing slash, as well as…

Max
- 128
- 5
2
votes
2 answers
geoip_country_name returns "-" in nginx
I am trying to install geoip module for nginx though dockerfile by adding to my dockerfile the following:
RUN apk add --no-cache libmaxminddb nginx-mod-http-geoip
RUN cd /var/lib; \
mkdir -p nginx; \
wget -q -O-…

Kosmylo
- 436
- 1
- 6
- 20
2
votes
1 answer
Replicate proxy_pass location behavior with variables
So usually when creating a nginx location it would look something like this:
location /foo/ {
proxy_pass http://example.com/;
}
With this setup, requests to /foo/bar are forwarded to http://example.com/bar which is the intended…

petroni
- 766
- 1
- 13
- 29
2
votes
1 answer
Nginx proxy_pass with variables
I've got 2 upstreams and described the logic of cookie check in nginx config:
upstream back {
server backend-release.mynamespace.svc.cluster.local;
}
upstream back-preprod {
server backend-preprod.mynamespace.svc.cluster.local;
}
map…

Andy
- 31
- 2
2
votes
1 answer
NGINX try_files can not find the "$1" in directory
I am hitting a problem with NGINX try_files and $1
I want NGINX to serve a file if it is already in a folder. If it is not in a folder, then the request should be sent to Django.
Here is the file in NGINX:
ls /app/processed/instagramwhite.svg…

np3228
- 85
- 6
2
votes
1 answer
Serve PDF file by location & query parameter
How can I serve a PDF file at the below address:
127.0.0.1/getMeThatFile/willYou?name=jane
which is stored at a location:
/usr/share/nginx/thatFile.pdf
I tried to follow Serve pdf file by location in nginx, but couldn't get it to work:
server {
…

Pushp Vashisht
- 874
- 3
- 9
- 17
2
votes
1 answer
How to correctly deploy/setup NestJS backend using Nginx?
I'm trying to deploy my webapplication using Angular and NestJs using Nginx on an Ubuntu remote server.
I got the frontend working on https://ikse.fransenit.nl/products but cannot get the backend to work. It was working fine locally. When I try to…

Jessey Fransen
- 135
- 2
- 11