前端:简单的nginx启动本地打包文件dist

Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。(看一下就行,前端用它启动就行了,下面内容10分钟就够了)

nginx下载使用

nginx修改配置

打开配置文件在这里插入图片描述

在这里插入图片描述

    server {
    
    
        listen 8082; // 端口号
        server_name localhost; // 服务名字
        // 代理服务地址 
        location /sales{
    
    
            proxy_pass https://uat-beijing.cbs.bacic5i5j.com/sales/; // 项目服务地址,需修改为自己用的
        }

        location /base {
    
    

        }
		// 我的项目
        location /sales-web/scm-customer-web {
    
    
            alias d:/project/scm-customer-web/dist/; // 项目dist文件位置 终端pwd即可显示
            index index.html;  
            try_files $uri $uri/ /sales-web/scm-customer-web/index.html;  // dist文件有index文件直接显示要不往下找
        }

    }

nginx启动

  1. 点击nginx启动
  2. 浏览器输入 http://local.cbs.bacic5i5j.com8082/sales-web/scm-customer-web/

注意事项

  1. 修改配置项需要重启nginx

猜你喜欢

转载自blog.csdn.net/qq_45234274/article/details/131331386
今日推荐