Answer the question
In order to leave comments, you need to log in
How to host an additional location in nginx?
Good afternoon,
Deployed the server running the application with the following configuration. But the url resource location always returns 404 for requests, although the specified path in the system (Ubuntu) exists along with the content, read rights for all users are registered for both the directory and the files inside it. The application is based on Spring, the tomcat configuration has not changed in any way, the / resource addresses are not used in any way and are not mapped.
server {
listen 80;
server_name <servername> ;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
location ~/resource {
<------>root /var/www/html/droid_resource;
<------>autoindex on;
<------>autoindex_exact_size off;
<------>autoindex_localtime on;
}
location / {
proxy_set_header X-Forwarded-Server $host;
<------>proxy_pass http://127.0.0.1:8081;
<------>proxy_set_header X-Forwarded-Proto $scheme;
<------>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/igarbage.ml/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/igarbage.ml/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
Answer the question
In order to leave comments, you need to log in
It is worth removing the tilde if you want to process /resource separately
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question