admin管理员组文章数量:1608631
因为是问题、花时间、所以进行记录一番
(一)安装环境:虚拟机centos7系统
对于nginx在linux下的安装卸载是装了又卸,卸了又装。远程访问就是访问不了,周五的时候能访问,到后面又不能访问了。其实这里可以有些方法的。
(二)验证nginx是否安装成功
首先根据这篇文章进行安装,使用源的方式安装:
(三)本地机器测试nginx是否能正常启动
所谓的本地机器,就是你安装了nginx软件的那一台机器,输入命令:
curl http://192.168.241.129/
这里的ip地址为你本机的ip地址
然后会有结果:
[root@localhost nginx-1.12.1]# curl http://192.168.241.129/
Welcome to nginx!body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to
nginx.
Commercial support is available at
nginx.
Thank you for using nginx.
[root@localhost nginx-1.12.1]#
以上验证了本地是已经安装成功的了,
但是我们远程访问的时候就是访问不了,一直说拒绝访问,那就是可能真的跟端口,防火墙有关了。
(四)防火墙、端口开启设置
打开80端口:
(1)
vi /etc/sysconfig/iptables
(2)
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
如图:
image.png
image.png
(五)远程访问:
版权声明:本文标题:nginx服务器远程无法访问,nginx首次安装远程无法访问 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1728550205a1163330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论