-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.txt
More file actions
36 lines (31 loc) · 1.68 KB
/
Copy pathnginx.txt
File metadata and controls
36 lines (31 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
常用命令:
nginx -s reload | reopen | stop | quit # 重新加载配置文件 | 重启 | 停止 | 退出 nginx
nginx -t:# 测试配置是否有语法错误
nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]
-?,-h # 打开帮助信息
-v # 显示版本信息并退出
-V # 显示版本和配置选项信息,然后退出
-t # 检测配置文件是否有语法错误,然后退出
-q # 在检测配置文件期间屏蔽非错误信息
-s signal # 给一个 nginx 主进程发送信号:stop(停止), quit(退出), reopen(重启), reload(重新加载配置文件)
-p prefix # 设置前缀路径(默认是:/usr/local/Cellar/nginx/1.2.6/)
-c filename # 设置配置文件(默认是:/usr/local/etc/nginx/nginx.conf)
-g directives # 设置配置文件外的全局指令
cat nginx.conf # 查看nginx配置
/usr/sbin/nginx:主程序
/etc/nginx:存放配置文件
/usr/share/nginx:存放静态文件
/var/log/nginx:存放日志
启动:nginx
查看进程号:ps -ef | grep nginx
杀死进程: kill -9 进程号
进入nginx配置文件目录:cd /etc/nginx
查看nginx配置文件 cat nginx.conf
编辑配置文件:vim nginx.conf 进入编辑模式 按 i 进行编辑,当编辑完之后按ESC键退出编辑模式,然后输入 :wq 并回车,保存修改并退出
Problem:
发生的情景:
vim nginx.conf 时异常退出,再进入时 提示 Found a swap file by the name ".nginx.conf.swp",目录下产生了.nginx.conf.swap隐藏文件, ls -a查看所有文件(.开头的为隐藏文件)
解决方案:
rm - .nginx.conf.swap
或者
恢复非正常关闭的文件