Questions related to nginx location directive should use this tag.
Questions tagged [nginx-location]
1424 questions
3
votes
1 answer
add header to response in nginx location directive
I try to add a response header to only one location path served and have an nginx config looks like
server {
...
add_header x-test test;
location /my.img {
rewrite ^/my.img$ /119.img;
add_header x-amz-meta-sig…

teddy
- 2,158
- 4
- 26
- 34
3
votes
2 answers
nginx proxy_pass removing base path
So I currently have a site at http://www.example.com and I would like that all requests from
http://www.example.com/api/v2/
to be proxied to
http://api.v2.com/
Note that http://api.v2.com does not have a base path.
My…

Marcelo Melo
- 421
- 4
- 9
3
votes
1 answer
How to exact match a nginx location?
I am configuring a nginx revser proxy. The result should be when user type http://10.21.169.13/mini, then the request should be proxy_pass to 192.168.1.56:5000. Here is the nginx config:
server {
listen 80;
server_name…

user938363
- 9,990
- 38
- 137
- 303
3
votes
2 answers
How can I configure shiny-server to run via NGINX on Ubuntu?
I am trying to configure a NGINX server so that a shiny server and shiny applications can be run via NGINX with proper password protection. My NGINX default file is shown in the example below:
server {
listen 80 default_server;
listen…

Kasper Christensen
- 895
- 3
- 10
- 30
3
votes
1 answer
Nginx Yii2 configuration in different folders
I faced with problem in configuring nginx server for yii2 basic app.
Here is my service block file :
server {
listen 80 ;
access_log /var/log/nginx/access-server.log;
error_log /var/log/nginx/error-server.log;
charset…

Farhad
- 742
- 6
- 22
3
votes
2 answers
Nginx invalid condition "="
I'm using Ngnix the following configuration :
upstream sync {
server couchbase-sync:4984;
} …

Alex Lévy
- 656
- 1
- 8
- 15
3
votes
1 answer
vue with nginx: path not matching
I am setting up vue(2.1.x) with nginx(1.10.2), I have following configuration:
location / {
root /var/lib/myRepo/dist/;
index index.html;
}
This works when I hit 'http://localhost:8080/', but when I hit other URLs like:…

Saurabh
- 71,488
- 40
- 181
- 244
3
votes
1 answer
Directadmin + Nginx + php fpm + location: File not found
I've a nginx conf in Direct Admin with a custom location:
Code:
location /reset-password {
alias /home/**/domains/**.**/public_html/api/frontend-scripts/resetPassword;
include /usr/local/directadmin/data/users/**/nginx_php.conf;
}
This…

Roy Milder
- 886
- 2
- 11
- 19
3
votes
1 answer
Nginx Multiple "Single Page App" routing
How to redirect to begins with "/admin" url redirect to /admin/index.html (single page app) and another pages redirect to /index.html (other single page app).
my nginx.conf is here
location / {
if ( $allowed = "deny" ) { return 403; }
…

Mesut Yiğit
- 649
- 10
- 21
3
votes
1 answer
Combining nginx rules for hidden files/directories
I'm setting up Let's Encrypt certificate for my website and I have a little problem with accessing ACME challenge files because of one of my location rules. Basically I have rule for denying access to hidden files along few others which I need for…

user1257255
- 1,161
- 8
- 26
- 55
3
votes
0 answers
How to debug nginx reverse proxy?
In my use case, I am trying to do a reverse proxy using nginx server. I have two applications running in two ports. For example app server is running port 9090 and api server is running in 8081.
I will be running nginx server in port in 8080. If I…

Dany
- 2,692
- 7
- 44
- 67
3
votes
1 answer
Configure Nginx to ignore a path in url
My website is at /root/website/, in it there is a folder static for static files, when the user visit: /static/dfd99a5/xxx.js, I wish to serve /root/website/static/xxx.js, how can I do this in nginx?

wong2
- 34,358
- 48
- 134
- 179
3
votes
1 answer
How to rewrite a path, forward parameters and add parameters?
This SO disucssion says that to forward parameters when rewriting an url using return the code should resemble this
location /path/to/resource {
return 301 /some/other/path/$is_args$args;
}
So far, so good. But how to add an arbitrary new…

Epigene
- 3,634
- 1
- 26
- 31
3
votes
1 answer
Nginx allow access to specific location, and return 444 for all others
I am trying to make it so my default server only allows access to one PHP file for AWS ELB's health check. I need PHP to serve it so it knows PHP is up/running on the instance. I am able to do the following to deny access with a 403:
server {
…

square
- 77
- 1
- 5
3
votes
3 answers
Changes to css, js, and static files not reflected on nginx docker container
I created a multi-container application which is about php. When I modify the php file, I can see the changes in the browser. But, when I modify the static files such as css and js, there are no changes in the browser. The following is my Dockerfile…

RyuGou
- 71
- 1
- 6