【发布时间】:2021-03-25 17:30:32
【问题描述】:
我有一个使用 Laravel + Nuxt 开发的网站。我正在使用 Nginx 运行网站。在 nuxt generate + nuxt start 我被重定向到 404 但在实时网站上我正在无限加载:https://flowerqueen.ro/aiusdhiusadfisadiufh。玩了很多配置文件并检查堆栈上的其他答案,没有任何帮助:(
这是我的 nginx 配置:
map $sent_http_content_type $expires {
default on;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}
server {
# redirect all HTTP to HTTPS
listen 80;
expires $expires;
index index.php index.html;
server_name flowerqueen.ro www.flowerqueen.ro;
return 301 https://flowerqueen.ro$request_uri;
}
server {
listen 443 ssl;
server_name flowerqueen.ro www.flowerqueen.ro;
#ssl on;
ssl_certificate /etc/ssl/certificate.crt;
ssl_certificate_key /etc/ssl/private.key;
index index.php index.html;
error_page 404 /404.html;
# expires $expires;
location / {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_cache cache;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 301 302 12h;
# try_files $uri $uri/ /404.html;
# add_header X-Proxy-Cache $upstream_cache_status;
}
location ^~ /images {
proxy_cache cache;
proxy_cache_valid 200 301 302 12h;
}
}
努克斯特:
ssr: true,
target: 'static',
server: {
port: 4000,
host: 'localhost',
},
【问题讨论】: