Nginx_Windos本地部署

  1. 安装跟配置

安装:

下载地址:nginx: download

Nginx_Windos本地部署

下载完成后,在指定位置解压缩,不要直接双击nginx.exe。

Nginx_Windos本地部署

配置:

server {
listen 10700; #输入端口号
server_name localhost;

location / {
            root   D:/nginx-1.16.1/html; #输入包的地址

        # 用于配合 browserHistory使用
            try_files $uri $uri/ /index.html;

            index  index.html index.htm;
        }
}
  1. 启动nginx :

启动nginx服务,启动命令为:start nginx,启动时会一闪而过是正常的

修改配置执行下面命名:修改完成后保存,使用以下命令检查一下配置文件是否正确,后面是nginx.conf文件的路径,successful就说明正确了

d:
cd D:\nginx-1.16.1
nginx -t -c /nginx-1.16.1/conf/nginx.conf
  1. 出现下面标识启动成功:
    nginx: the configuration file D:/nginx-1.16.1/conf/nginx.conf syntax is ok
    nginx: configuration file D:/nginx-1.16.1/conf/nginx.conf test is successful

  2. 刷新配置:nginx -s reload

  3. 出现错误:nginx: [error] invalid PID number “” in “D:\nginx-1.16.1/logs/nginx.pid”
    原因:D:\nginx-1.16.1\logs文件夹下面缺少文件nginx.pid
    解决:添加文件并且文件内部添加数字:395180

  4. 出现错误:原因:那是系统在你修改配置文件的时候,将你的nginx关闭了
    nginx: [error] OpenEvent(“Global\ngx_reload_2144”) failed (2: The system cannot find the file specified)
    解决:start nginx

Nginx_Windos本地部署

Nginx_Windos本地部署
  1. 关闭nginx服务使用以下命令,同样也是一闪而过是正常的,看一下是否进程已消失即可

快速停止: nginx  - s stop

完整有序的关闭: nginx  - s quit

Original: https://www.cnblogs.com/ingstyle/p/15497322.html
Author: 彪悍的代码不需要注释
Title: Nginx_Windos本地部署

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/543577/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球