小编Ale*_*kov的帖子

NGINX 在页面重新加载时返回 404 错误(Ember 应用程序)

我正在使用 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;
        } …
Run Code Online (Sandbox Code Playgroud)

nginx ember.js nginx-location nginx-config

1
推荐指数
1
解决办法
923
查看次数

标签 统计

ember.js ×1

nginx ×1

nginx-config ×1

nginx-location ×1