Questions related to nginx location directive should use this tag.
Questions tagged [nginx-location]
1424 questions
-1
votes
2 answers
Script to produces Kubernetes manifests to deploy bare nginx container
I would like to have a script that produces Kubernetes manifests to deploy a bare nginx container with service port 80 and ingress for host as example.nginx.com. I will deploy it into EKS cluster. Can someone give me clue?

Melissa Jenner
- 781
- 1
- 8
- 31
-1
votes
1 answer
Nginx: how to do context path redirect,rewrite or reverse and proxy setting for application
I am new to NgInx.
I don't know i have to ask or not but step forward and i need it for my application redirection.
I have 2 Asp.net web applications and based on domain and context path i need to redirect to particular…

cj devin
- 1,045
- 3
- 13
- 48
-1
votes
1 answer
(Nginx location regex issue) Need regex that matches either specific file extensions OR no extension
I need a Nginx location regex that matches either specific file extensions (like html, css, js) OR no extension. A trailing slash should not matter. For example, https://example.com/blah, https://example.com/blah.css, https://example.com/blah.css/,…

Starscream512
- 103
- 7
-1
votes
1 answer
How do i redirect a url/abc to url/abc/live-preview where abc is a variable name?
I have a url - https://sambit.com/hub/abc which i want to redirect to https://sambit.com/admin/sites/editors/hub-page/abc/live-preview where abc is a variable value .
i wrote a nginx config like this -
location /hub { rewrite ^/hub(.*)$…

sambit
- 339
- 4
- 12
-1
votes
1 answer
Nginx: Serving all content from the same directory on the server (even though the URL changes)
I built a React app and all of the files are served from the same physical directory on my Nginx server. I use react-router-dom to navigate through the app. Everything works when I first load the app.
I'll navigate to a URL that react-router-dom…

Marc
- 1,470
- 2
- 16
- 25
-1
votes
1 answer
Proxy_pass to second address if first isn't available (502 for instance)
When I send query to example.com/nodeService and node service on port 3001 returns 502 error, I need to redirect me on 3002 port without client application knowing about error. Is there such functionality in nginx? Thanks.
location /nodeService/ {…

Amir Afendin
- 39
- 5
-1
votes
1 answer
nginx server location route
Its my nginx configuration file
server {
listen 80;
server_name san.cashbaba.com.bd www.san.cashbaba.com.bd;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade…

tapos ghosh
- 2,114
- 23
- 37
-1
votes
2 answers
Simple nginx redirect doesn't match
I was originally trying to do a complicated URL rewrite which I couldn't get working, so stripped it back to a simple URL redirect which should definitely work, instead it throws a 404.
Requests for [any_scheme]://www.mydomain.com/google should…

Jon
- 452
- 4
- 23
-1
votes
1 answer
Let Nginx pass current location
I have nginx reverse-proxy to my site on IIS and here is my nginx config:
UPDATE
upstream backend {
server 43.128.77.101;
}
server {
server_name domain.subdomain.com;
location /products {
if ($query_string ~ Jeans){
return 301…

KozhevnikovDmitry
- 1,660
- 12
- 27
-1
votes
1 answer
502 Bad Gateway node server nginx
i built react app which is running on node server, i'm using multiple submain in same gcloud instance.using pm2 i'm running those app which works fine on different ports.
right now i want to implement nginx on my vm so i can target those apps with…

zulqarnain
- 1,536
- 4
- 26
- 44
-1
votes
1 answer
nginx redirection to another server
I compiled the nginx 'echo-nginx-module' module to log the request body.
My goal is to log and reverse proxy all the traffic coming to nginx to another DNS.
I am using proxy_pass to redirect the traffic to the second DNS and it successfully started…

Saman
- 177
- 2
- 2
- 7
-1
votes
1 answer
nginx change basepath html folder to another disk ubuntu 18.4
Hello I'm new to ubuntu 18.4
I want to change html folder from
/var/www/html
to another directory usually at ubuntu 16.4 i used to change basepath at
/etc/nginx/sites-available/default
to the location but the new location is at another partition…

M7Shapan
- 107
- 6
-1
votes
1 answer
rewrite url but show original url + nginx
I am new to nginx.
I am trying to redirect to some page ("example.com/randomText/abc") to page ("example.com/abc") with nginx.
location ~ ^/(.*/abc){
#method 1
rewrite (.*) /abc break;
#method 2
#return 301 http://$host/abc;
#method 3
#proxy_pass…

sagar more
- 91
- 1
- 7
-1
votes
1 answer
Pass encoded request_uri and remove string
A web-application setup using a CouchDB database is giving me a headache. The issue seems to be, that the document ID's contain special characters as "/", "-" or spaces. Here is an example URL…

Christoph Pahmeyer
- 513
- 1
- 5
- 17
-1
votes
2 answers
Requests sequence in Nginx
I have a scenario when server needs to do authorization request before an actual request. so, one request are served by 2 different services.
Nginx's location has to be handled by Auth-Service, and if the response status is 200 OK, then the request…

yvs
- 507
- 3
- 19