nginx 布署文件服务器

2019-04-04  本文已影响0人  MinicupSimon

Windows环境
Nginx (engine x)

下载

http://nginx.org/

解压

image.png

运行nginx.exe

image.png

浏览器访问

image.png

nginx.exe无法启动,闪退

https://www.cnblogs.com/xiohao/p/4282288.html

1.以管理员身份打开cmd

  1. net stop http 命令后 y 同意

相关命令

start nginx.exe 启动服务器
nginx -s reload 重新载入配置文件
nginx -s stop 停止 Nginx
nginx -s reopen 重启 Nginx

配置示例

server {
        listen       80;
        server_name  localhost;
        location / { #浏览器访问http://localhost/ 时会访问nginx安装目录/html/index.html
            root   html;
            index  index.html index.htm;
        }
        
        location /tools/ { #浏览器访问http://localhost/tools/ 时会访问电脑D盘
            alias D:/;
            allow all;
            autoindex on;
        }
}
image.png

nginx -s stop 不起作用:
执行命令后,若还是能访问,
1.查看任务管理器,结束进程
2.浏览器缓存问题,刷新

上一篇 下一篇

猜你喜欢

热点阅读