(1)nginx启动与关闭
nginx启动命令:
(一闪而过为正常启动,且看不到nginx进程)
D:\server\nginx\nginx-1.16.0>start nginx
nginx关闭命令:
快速停止:nginx -s stop
完整有序的停止:nginx -s quit
如:
D:\server\nginx\nginx-1.16.0>nginx -s quit
(2)简单配置nginx
(这里只监听本地8082端口。)
注:启动时,此端口不可被占用
配置文件路径:D:\server\nginx\nginx-1.16.0\conf\nginx.conf
server {
listen 8082;
server_name localhost;
…
}
(3)验证配置文件,并重新加载
验证配置文件是否有语法错误:
D:\server\nginx\nginx-1.16.0>nginx -t -c .\conf\nginx.conf
nginx: the configuration file D:\server\nginx\nginx-1.16.0/.\conf\nginx.conf syntax is ok
nginx: configuration file D:\server\nginx\nginx-1.16.0/.\conf\nginx.conf test is successful
验证成功后,重新加载配置文件:
nginx -s reload
(4)访问测试
(访问路径:http://localhost:8082/)
跳转至如下首页文本即初步配置成功!!!
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.