无法访问本地网络中的NGINX服务器

时间:2019-05-28 22:15:04

标签: nginx local linuxmint

我无法通过其他本地计算机连接到Linux Mint Distro上托管的Nginx服务器。我可以在同一台计算机上通过localhost或127.0.0.1正常连接。

在手机上,如果我在Chrome / Firefox中输入计算机的本地IP,则显示为“无法连接”。我可以ping计算机并接收回来的数据,反之亦然,但是nginx无法连接。

本地IP为192.168.1.54,我手机的IP为192.168.1.56

使用server_name 192.168.1.54和server_name 192.168.1.56尝试,均无效。

尝试启用ufw并添加http和https作为规则,但无效。仍然无法连接。我很困惑。

        # Default server configuration
    #
    server {
        #listen 80 default_server;
        #listen [::]:80 default_server;

        listen 80;
        listen [::]:80;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/test;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
        }

        # pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
        #   # With php-fpm (or other unix sockets):
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }

    }

从同一网络上的其他本地计算机在浏览器中输入nginx服务器的IP地址时,“无法连接”。

在/ var / log / nginx /

中进行尝试时,不会显示错误消息或访问日志。

0 个答案:

没有答案