服务器安装nginx

本文最后更新于:3 年前

安装nginx

连接服务器
执行ssh root@ip命令
安装nginx
执行yum -y install nginx命令
等待安装完成
当出现完毕!时,代表安装完成了

启动nginx服务

执行service nginx start命令
会看到Redirecting to /bin/systemctl start nginx.service,代表启动服务完成
然后在浏览器输入你的服务器ip会看到nginx的信息

无法访问

假如无法通过服务器ip访问,显示无法连接
服务器防火墙阻拦了,需要关闭防火墙
执行systemctl stop firewalld.service命令,停止防火墙
执行systemctl disable firewalld.service命令,禁止防火墙开机启动
重新访问你的服务器ip,会发现可以看到Welcome to nginx on Fedora!

停止nginx服务

执行service nginx stop命令
会看到Redirecting to /bin/systemctl stop nginx.service,代表停止服务完成

重启nginx服务

执行service nginx restart命令
会看到Redirecting to /bin/systemctl restart nginx.service,代表重启服务完成



本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!