进入nginx安装目录sbin下
nginx -c nginx配置文件地址:? 启动
[root@dev-test sbin]# ./nginx -c /usr/local/nginx/conf/nginx.conf
nginx -t : 验证nginx配置文件是否正确,看到nginx.conf syntax is ok
nginx.conf test is successful 说明配置文件正确。
[root@dev-test sbin]# ./nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
nginx -s reload :? 重启
[root@dev-test sbin]# ./nginx -s reload
活动:慈云数据爆款香港服务器,CTG+CN2高速带宽、快速稳定、平均延迟10+ms 速度快,免备案,每月仅需19元!! 点击查看 nginx -s stop : 快速停止nginx
[root@dev-test sbin]# ./nginx -s stop
nginx -s quit : 完整有序的停止nginx
[root@dev-test sbin]# ./nginx -s quit
查询nginx主进程号
[root@dev-test sbin]# ps -ef | grep nginx
在进程列表里 面找master进程,它的编号就是主进程号了。
?
从容停止Nginx:kill -QUIT 主进程号 快速停止Nginx:kill -TERM 主进程号 强制停止Nginx:kill -9 主进程号
mac nginx 自启动
通过brew install nginx命令安装的nginx实现自启动执行如下命令(homebrew)
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemonssudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
重启电脑即可
常用操作
1.nginx根目录访问本地项目
location / {root /Users/projectName;index index.html index.htm;}
2.nginx location 访问本地项目
location /ehrProject {alias /Users/ehrProject;}
3.nginx 配置接口请求反向代理
location /api/v3 {proxy_pass http://www.baidu.com;}
?
28642866
《服务器重启后服务启动,nginx服务器重启》来自互联网同行内容,若有侵权,请联系我们删除!
还没有评论,来说两句吧...