window nginx 安装、编辑location及代理、命令启动、重启、停止 、查看版本-CSDN博客

31 阅读1分钟
1. 安装

这里写图片描述

2.编辑 nginx\conf\nginx.conf
server {
    listen       8080;//服务端口
    server_name  localhost;//域名
    location / {
        root   C:\Users\Administrator\Desktop\study\ydc-vue\dist;//引用文件地址
        index  index.html index.htm; // 首页文件
    }
    location /apis {
        proxy_pass http://www.***.com/; // 代理(注:代理网址最后的‘/’是否需要)
    }
}
3.命令 (在nginx 文件夹根目录运行)
  • 启动 start nginx (注:启动失败 ,查看日志 nginx\logs\error.log进行判断)
  • 停止 nginx -s stop
  • 重启 nginx -s reload
  • 查看版本 nginx -v