下载安装参考:https://www.cnblogs.com/qfb620/p/5508468.html
Windows下Nginx的启动、停止等命令
在Windows下使用Nginx,我们需要掌握一些基本的操作命令,比如:启动、停止Nginx服务,重新载入Nginx等,下面我就进行一些简单的介绍。
1、启动:
注意:使用后台启动必须配置daemon on;
start nginx【后台启动】
nginx.exe【临时启动】
2、停止:
nginx.exe -s stop或
nginx.exe -s quit
注:stop是快速停止nginx,可能并不保存相关信息;quit是完整有序的停止nginx,并保存相关信息。
3、重新载入Nginx:
nginx.exe -s reload
当配置信息修改,需要重新载入这些配置时使用此命令。
4、重新打开日志文件:
nginx.exe -s reopen
5、查看Nginx版本:
nginx -v
# 是否设置后台运行默认是on后台运行!:
daemon on;
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# 是否设置后台运行默认是on后台运行!:
daemon on;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name 119.28.180.116;
root /usr/share/nginx/html;
}