nginx配置
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
#解决vue history方式刷新浏览器URL页面404问题
try_files $uri $uri/ /index.html;
}
}
nginx docker-compose.yml
version: "3"
services:
web:
image: nginx
container_name: nginx
volumes:
- ./conf.d:/etc/nginx/conf.d
- ./html:/usr/share/nginx/html
ports:
- 80:80
版权所有 © 【代码谷】 欢迎非商用转载,转载请按下面格式注明出处,商业转载请联系授权,违者必究。(提示:点击下方内容复制出处)
源文:《Nginx+Vue实现二级子目录history和hash两种模式访问》,链接:https://www.daimagu.com/article/934.html,来源:【代码谷】
评论