Answer the question
In order to leave comments, you need to log in
Nginx, add to .html url?
The task seems to be simple, but I didn’t work much with nginx, I read the docks, forums, and threw in such a config
server {
listen 80;
server_name 10.10.8.1;
charset utf-8;
client_max_body_size 75M;
location /media {
alias /web/media;
}
location /static {
alias /web/static;
}
location /robots.txt {
alias /web/robots.txt;
}
location /presentations {
alias /web/landings;
try_files $uri @present;
}
location @present {
rewrite ^/presentations/(.*)$ /presentations/$1.html break;
}
location / {
uwsgi_pass unix:/websocket/mysite.sock;
include /etc/nginx/uwsgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
The nginx config is declarative. alias remains in location /presentations/, and the request is already processed in location @present
However, in fact, the config needs to be made simpler:
server {
listen 80;
server_name 10.10.8.1;
charset utf-8;
client_max_body_size 75M;
root /web;
location /media {
}
location /static {
}
location /robots.txt {
}
location /presentations {
alias /web/landings;
try_files $uri $uri.html =404;
}
location / {
uwsgi_pass unix:/websocket/mysite.sock;
include /etc/nginx/uwsgi_params;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question