发布到服务器后可以正常访问,但是刷新当前页面不行,报404错误
解决办法:修改nginx配置
修改前:
server {
listen 80;
server_name xxx.xxx.com;
location / {
root /var/www/build;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html;
}
}
修改后:
server {
listen 80;
server_name xxx.xxx.com;
location / {
root /var/www/build;
try_files $uri /index.html
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html;
}
}