1.未设置开机启动前直接启动nginx
[root@www sbin]# pwd
/usr/local/nginx1/sbin
[root@www sbin]# ls
nginx
[root@www sbin]# ./nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
2.设置开机启动
/etc/rc.local
/usr/local/nginx1/sbin/nginx
chmod +x /etc/rc.d/rc.local
3.关闭nginx
nginx -s stop 立即停止,不推荐使用
nginx -s quit
nginx -s reload 修改了配置文件,相当于刷新服务 (=nginx -s quit +nginx)
nginx -s reopen 重新生成一个新的日志文件
nginx -t 测试nginx.conf配置文件是否有错误
4.判断nginx是否启动
1.看端口 lsof -i :80
2.看进程号 ps aux |grep nginx
netsate -anplut