admin管理员组

文章数量:1608632

> 因为是问题、花时间、所以进行记录一番

(一)安装环境:虚拟机centos7系统

对于nginx在linux下的安装卸载是装了又卸,卸了又装。远程访问就是访问不了,周五的时候能访问,到后面又不能访问了。其实这里可以有些方法的。

(二)验证nginx是否安装成功

首先根据这篇文章进行安装,使用源的方式安装:

centos7安装nginx

(三)本地机器测试nginx是否能正常启动

所谓的本地机器,就是你安装了nginx软件的那一台机器,输入命令:

curl http://192.168.241.129/

这里的ip地址为你本机的ip地址

然后会有结果:

[root@localhost nginx-1.12.1]# curl http://192.168.241.129/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx/">nginx</a>.<br/>
Commercial support is available at
<a href="http://nginx/">nginx</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[root@localhost nginx-1.12.1]# 

以上验证了本地是已经安装成功的了,

但是我们远程访问的时候就是访问不了,一直说拒绝访问,那就是可能真的跟端口,防火墙有关了。

(四)防火墙、端口开启设置

打开80端口:


本文标签: 首次无法访问LinuxNginx