Questions related to nginx location directive should use this tag.
Questions tagged [nginx-location]
1424 questions
-1
votes
1 answer
Nginx deny all json files in root directory
How can i have location directive for all json files in all subfolders but if file is in root directory it should return 404.
/test.json - 404
/$anything/test.json - found

Dejan Milosevic
- 19
- 6
-1
votes
1 answer
Unable to serve the nested css & js files via nginx?
I've read some documentation and tried and number of alternatives from previous answers on this site but cannot get nginx to serve my css & js files from my flask app. In my code i have for example:

MattE
- 159
- 12
-1
votes
1 answer
How to rewrite to subdomain using nginx?
i want to join two seperate servers by url rewrite.
When mysite.com/blog/blog-title -> wp.mysite.com/blog-title
Two servers are in aws too. There is a front cloudflare dns setup.

user305015
- 105
- 9
-1
votes
1 answer
Nginx Server not responding
Nginx server is not responding periodically like every 30 minutes.
I have to reload it by nginx -s reload.
How to resolve the problem?
I can able to ping host. But unable to establish http request.

Ram Krishna
- 11
- 1
- 4
-2
votes
1 answer
How to write a Dockerfile in Windows? Where the images are stored in Windows?
I dont understand a couple things with docker on Windows.
I need to write a simple Dockerfile. I need to do this in VS Code to push it to my GitLab repository. And here is my problem: I need to use nginx image, but with my own .html part.
I know I…

Skyeee
- 69
- 1
- 7
-2
votes
1 answer
PCRE Nginx regexp matching any of words or ending with suffix
How can I write an Nginx regexp mathing location containg foo|bar|baz or ending with /beautifu.html?
sth like location ~ ^/.*(foo|bar|baz)/.*$ but also matching .*/beautiful.html

bastiat
- 1,799
- 2
- 19
- 38
-2
votes
2 answers
Redirecting in NGNIX in localhost
i want when i write 10.10.0.0 in browser, it takes me index page.but it doesnt
I tried
server {
listen 8080;
server_name 10.10.0.0;
return 301 http://localhost:8080/index.html;
}

Elvin Jafarov
- 41
- 1
- 1
- 10
-2
votes
1 answer
Nginx 500 out of the var folder
I'm using nginx and I need help with the configuration. If I change the location from
root /var/www/html
to
root /spectrum/public
Where the index.html file is located I get the 500 error.
Take a look on the nginx default file
server {
listen…
user8924018
-2
votes
4 answers
Reverse proxying to static website not working
I have a nginx server running at www.example.com.
Within it, I have set up a reverse proxy to a static website of mine hosted with Zeit now.
location /apps/app1/ {
proxy_pass https://app1.username.now.sh;
}
However, when I visit…

bluprince13
- 4,607
- 12
- 44
- 91
-2
votes
1 answer
File not found for php files
I have wordpress running behind nginx reverse proxy.
Home etc works fine but when user goes to url with .php ending, I'm getting 404 File not found. error.
Here is related nginx configuration:
location /en/us/ {
proxy_pass…

Mohamed
- 1,251
- 3
- 15
- 36
-2
votes
1 answer
Refuse to download non-php files
I want my server to refuse to view and download all non-php files, So i wrote this code in "nginx.conf":
I restarted the server, did some testing, and found that it didn't work. Where is the mistake, please?

Wang Hao
- 3
- 2
-3
votes
1 answer
Multiple configurations with different locations (React App) at the same domain using Nginx
I'm trying to configure Nginx for 2 different locations.
This is my scenario.
www.example.com
location : /var/www/example.com
example.com/panel
location : /var/www/example.com/panel
-3
votes
1 answer
How can running compiled code or script in nginx
exec_push /usr/bin/ffmpeg -re -i rtmp://localho ...
this code running but
exec_push /usr/bin/output
exec /usr/bin/output
exec /usr/bin/test.sh
these codes do not work, but the same codes work on the terminal. why?
they are in there I moved.…

Hakan Murat Aksüt
- 17
- 1
- 2
- 10