Я использую nginx для обслуживания целевой страницы, SPA (Ember) и сервера Rails в одном домене.Кажется, все работает хорошо, за исключением случаев, когда я обновляю некоторые из маршрутов SPA, например, https://server_name.ru/app/login NGINX возвращает ошибку 404 /home/aborovkov/apps/frontend/dist/login" failed
.Как это исправить?
server {
root /home/aborovkov/apps/landing;
index index.html index.htm index.nginx-debian.html;
try_files $uri $uri/ /index.html?/$request_uri;
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
add_header Pragma "no-cache";
server_name server_name.ru www.server_name.ru;
access_log /etc/nginx/server_name.access.log;
error_log /etc/nginx/server_name.error.log;
location /app {
alias /home/aborovkov/apps/frontend/dist;
index index.html index.htm index.nginx-debian.html
try_files $uri $uri/ /index.html?/$request_uri;
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
add_header Pragma "no-cache";
}
location /api/ {
root /home/aborovkov/apps/api/current/public;
proxy_pass http://localhost:3000;
passenger_enabled on;
passenger_app_env production;
client_max_body_size 100m;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/server_name.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/server_name.ru/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.server_name.ru) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = server_name.ru) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name server_name.ru www.server_name.ru;
return 404; # managed by Certbot
}