nginx安装与启动
安装
windows下的nginx的安装包地址为:http://nginx.org/en/download.html
启动
启动命令:前往解压目录下–》cmd–》start nginx进行启动,此时会有一个窗口闪退,是正常的。
可前往浏览器输入localhost查看是否启动成功。
这里不使用nginx.exe进行启动,因为会锁死cmd窗口。
常用命令
- nginx -s reopen 重启
- nginx -s stop 关闭
- nginx -s reload 重新加载配置文件并重启
注释:在安装完成后,曾打算在环境变量中配置一下安装路径,这样不用每次都去安装路径下
去启动服务,但是发现这样无法读取conf文件,
C:\Users\haha>nginx -s reload
nginx: [alert] could not open error log file: CreateFile() "logs/error.log" fail
ed (3: The system cannot find the path specified)
2018/08/09 09:11:12 [emerg] 8344#8736: CreateFile() "C:\Users\haha/conf/nginx.co
nf" failed (3: The system cannot find the path specified)
这是由于系统会去c:/users/xxx下去找conf文件,所以提示找不到,暂无解决方案,还是去安装目录下启动比较好。