一、启动,重启,停止nginx命令
我的linux是ubuntu20lts版本 启动nignx:$ service nginx start 重启nignx:$ service nginx restart 停止nignx:$ service nginx stop
二、启动nginx
$ service nginx start 发现启动失败,输入 $ systemctl status nginx.service 说明有程序占用80端口,查看是哪个程序在使用80端口,输入 $ netstat -anp|grep 80 查看发现,是apache占用了80端口,杀死进程 $ kill -9 671
再次输入 $ sudo netstat -anp|grep 80 输入发现,还是apache占用了80端口。这时候就要停止apache了,因为我服务器是没有安装过apache的。然后执行以下命令,停止apache->再次启动nginx->查看状态,发现启动成功了!! 停止apache:$ sudo /etc/init.d/apache2 stop 再次启动nginx:$ service nginx start 查看状态:$ service nginx status ![在这里插入图片描述](https://img-blog.csdnimg.cn/20200527111019622.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Jlbl9jeHk=,size_16,color_FFFFFF,t_70#pic_center)
|