PHP笔记网

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2020-07-27 18:15:41  修改时间:2024-11-18 22:51:59  分类:电脑/软件使用  编辑

1、下载最新版本 Nginx(前往下载);

2、解压某个目录,如:D:\nginx\

3、启动 nginx:

start D:/nginx/nginx.exe

4、关闭 nginx:

D:/nginx/nginx.exe -s stop

5、干脆写一个 .bat 文件吧(文件名:D:\nginx\nginx_restart.bat),后续直接双击执行该文件即可!

D:/nginx/nginx.exe -s stop  # 注意:后改为了 -s quit
start D:/nginx/nginx.exe

6、常用功能:nginx代理配置 参考

server {
    listen 80;
    server_name     dev.php-note.com;
    access_log      logs/dev.php-note.com_access.log;
 
    location / {
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8080;
    }
}

报错1:

could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 

解决方案:

在配置文件的 http{ } 段增加一行配置

server_names_hash_bucket_size 64;

如果64还不够,那么就按32的倍数往上加。

报错2:

OpenEvent("Global\ngx_stop_79820") failed (2: The system cannot find the file specified)

解决方案:

关闭 nginx 的方式,由 nginx -s stopnginx -s reload,改为 nginx -s quit

 

 

参考:

nginx for Windows

nginx could not build the server_names_hash 解决方法

nginx: [error] OpenEvent("Global\ngx_reload_5744") failed (2: The system cannot find the file spe...