服务器操作相关命令
- 测试 nginx 配置文件,测试成功后重新加载 nginx 配置文件
[root@localhost tengine]# ./sbin/nginx -t -p /opt/bigmw/tengine
nginx: [emerg] invalid number of arguments in "set" directive in /opt/bigmw/tengine/conf/power/powercommon-location.conf:82
nginx: configuration file /opt/bigmw/tengine/conf/nginx.conf test failed
[root@localhost tengine]# ./sbin/nginx -t -p /opt/bigmw/tengine
nginx: the configuration file /opt/bigmw/tengine/conf/nginx.conf syntax is ok
nginx: configuration file /opt/bigmw/tengine/conf/nginx.conf test is successful
[root@localhost tengine]# ./sbin/nginx -s reload -p /opt/bigmw/tengine
[root@localhost tengine]#
- 重新加载 Nginx 配置文件
nginx -s reload
nginx -s reload -p /opt/bigmw/tengine
- 启动停止nginx
nginx
nginx -s stop # 停止
- 查看Nginx是否运行,以及部署目录
ps -ef|grep nginx #查看master进程ID
ll /proc/2030/exe #(2030为master进程ID)
示例:
[root@localhost ~]# ps -ef|grep nginx
root 8951 5986 0 10:51 pts/0 00:00:00 grep --color=auto nginx
root 11026 1 0 9月19 ? 00:00:00 nginx: master process ./sbin/nginx
nobody 25071 11026 0 9月19 ? 00:00:11 nginx: worker process
nobody 25072 11026 0 9月19 ? 00:00:10 nginx: worker process
[root@localhost ~]# ll /proc/11026/exe
lrwxrwxrwx. 1 root root 0 9月 19 16:56 /proc/11026/exe -> /usr/local/webserver/nginx/sbin/nginx