首页 > 其他 > 详细

nginx搭建静态资源服务器

时间:2018-12-25 10:41:58      阅读:222      评论:0      收藏:0      [点我收藏+]

nginx配置访问前端工程

1.前端工程目录
crm-view
|-- view
|-- user.html
2.工程位置

C:\Users\Administrator\Desktop\CRM系统\crm-view

3.配置nginx

找到nginx安装目录打开conf/nginx.conf添加如下节点配置

#vue工程跳转
    server {
        #访问端口
        listen 8081;
        server_name localhost;
?
?
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        root html;
        }
?
        # 页面跳转
        root C:\Users\Administrator\Desktop\CRM系统\crm-view;
        index index.html;
?
?
        location / {
        try_files $uri $uri/ @router;
        index index.html;
        }
?
?
        location @router {
        rewrite ^.*$ /index.html last;
        }
    }
?
4.通过nginx访问页面

http://127.0.0.1:8081/view/user.html

nginx搭建静态资源服务器

原文:https://www.cnblogs.com/covet/p/10172492.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!