Nginx+Vue实现二级子目录history和hash两种模式访问

位置:首页>文章>详情   分类: 教程分享 > nginx教程   阅读(893)   2024-03-16 09:29:22

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

 

标签:
地址:https://www.leftso.com/article/934.html

相关阅读

nginx配置server { listen 80; server_name localhost; #access_log /var/log...
Linux(centos) nginx安装和nginx入门配置方法1.切换至root用户$su - 2.执行在线安装命令#yum install nginx -y 如果上面提示以下内容[root...
最近网站被恶意访问了,了解了一些基础防护手段,nginx屏蔽ua访问 编写文件agent_deany.conf #使用方法 #创建目录 /etc/nginx/conf.d/deny [注意]...
1.新增nginx屏蔽配置文件文件暂时为/etc/nginx/conf.d/deny_ua.config说明:文件名deny_ua.config,后缀为.config非.conf,原因是.con...
场景描述某些情况下有些资源需要一个基本的认证才能让用户访问
nginx常规使用时作为http协议的反向代理,这里要讲的是非http的Mysql端口代理,理论支持其他协议nginx.conf配置如下:user nginx; worker_processe...
nginx日志默认格式如下:$remote_addr-$remote_user[$time_local]"$request"$status$body_bytes_sent"$http_refer...
最近博客升级总是nginx原生的502页面,感觉有些不友好,特此研究了下502页面的配置nginx 502配置502页面核心配置 #502 page error_p...
打开任务管理器发现一大堆nginx进程
解决centos系统使用yum安装nginx启动时报错[::]:80 failed (97: Address family not supported by protocol)一般默认的使用yu...