Open wolichuang opened 3 years ago
1、启动:
C:\server\nginx-1.0.2>start nginx或 C:\server\nginx-1.0.2>nginx.exe
2、停止:
C:\server\nginx-1.0.2>nginx.exe -s stop或 C:\server\nginx-1.0.2>nginx.exe -s quit
注:stop是快速停止nginx,可能并不保存相关信息;quit是完整有序的停止nginx,并保存相关信息。
3、重新载入Nginx:
C:\server\nginx-1.0.2>nginx.exe -s reload ./nginx -s restart
当配置信息修改,需要重新载入这些配置时使用此命令。
4、重新打开日志文件:
C:\server\nginx-1.0.2>nginx.exe -s reopen tail -f ./log/error.log
5、查看Nginx版本:
C:\server\nginx-1.0.2>nginx -v
6、nginx-1.14.0/logs/nginx.pid" failed (2: The system cannot find the file specified) **
打开系统任务管理器,找到nginx.exe进程,kill掉它
7、检查nginx是否启动成功
tasklist /fi "imagename eq nginx.exe" # 查看端口是否占用 netstat -ano | findstr 0.0.0.0:80 或 netstat -ano | findstr "80" # 执行命令 nginx.conf文件所在目录 nginx -t
8、阿里云入口方向添加 端口
# 新增配置规则 0.0.0.0/0
9、防火墙设置
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload firewall-cmd --add-port=80/tcp --permanent firewall-cmd --add-port=8080/tcp --permanent systemctl start nginx #启动 systemctl stop nginx #停止 systemctl restart nginx #重启 systemctl status nginx #查看运行状态 systemctl enable nginx #开机启动 service firewalld restart # 从启动防火墙
10、linux中nginx配置访问路径
日志中显示,自动跳到Linux安装目录根路径下htm文件中, 注意:其中htm路径为nginx默认配置的路径,其配置代码如下 # 解决 user root;
11、mac 下查看 nginx目录
brew search nginx //查询要安装的软件是否存在
12、nginx.conf
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { #侦听8080端口 listen 8080; #定义使用 localhost访问 server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #定义服务器的默认网站根目录位置 root html; #定义首页索引文件的名称 index index.html index.htm; } ... ... ... (注释代码太多,就不全部贴出来了) include servers/*; }
1、启动:
2、停止:
注:stop是快速停止nginx,可能并不保存相关信息;quit是完整有序的停止nginx,并保存相关信息。
3、重新载入Nginx:
当配置信息修改,需要重新载入这些配置时使用此命令。
4、重新打开日志文件:
5、查看Nginx版本:
6、nginx-1.14.0/logs/nginx.pid" failed (2: The system cannot find the file specified) **
7、检查nginx是否启动成功
8、阿里云入口方向添加 端口
9、防火墙设置
10、linux中nginx配置访问路径
11、mac 下查看 nginx目录
12、nginx.conf