1.安装
下载nginx,下载链接(https://nginx.org/en/download.html)
![](https://img.haomeiwen.com/i28361474/913fbd0f14b862e6.png)
2.配置
1.打开nginx
2.打开conf
3.打开nginx.conf
4.配置端口号
![](https://img.haomeiwen.com/i28361474/ccdd50bcac6ce8c2.png)
4.修改完成后保存,使用以下命令检查一下配置文件是否正确,后面是nginx.conf文件的路径,successful就说明正确了
nginx -t -c /nginx-1.15.2/conf/nginx.conf
![](https://img.haomeiwen.com/i28361474/607686f392c47733.png)
3.运行nginx
在nginx目录下打开dos窗口,输入命令行
常用的命令行语句
start nginx 运行nginx
nginx -s stop 关闭
nginx -sreload 重启
4.访问服务器
在浏览器地址栏中输入 “localhost:xxxx” xxxx为监听的端口号
![](https://img.haomeiwen.com/i28361474/c3d6b9753616e9a5.png)
5.部署项目到nginx
1.打包好的vue项目将压缩包放到nginx根目录下的html进行解压
2.配置nginx中的nginx.conf中的访问根目录
![](https://img.haomeiwen.com/i28361474/da22641027862d28.png)
红色方框的换成项目访问的地址
3.访问
其他人访问: ip+端口号+访问路径
xxx.xx.x.xxx:8800/adm/docs/ami-ui/
6.查看nginx是否运行
1)在浏览器输入:http://localhost/ 或者 http://localhost:80
2)在cmd命令窗口输入命令 tasklist /fi “imagename eq nginx.exe” ,出现如下结果说明启动成功
3)在任务管理器-详细信息中查找nginx线程
查看自己ip地址
全局cmd中输入ipconfig
网友评论