端口 80 正在重定向,除本地网络外无法访问

端口 80 正在重定向,除本地网络外无法访问

我知道这可能非常简单,但我还不是 Nginx 或 Linux 的专业人士。

我有一个配置了端口 80 的 Wordpress MU 网络(我可以在 LAN 上的 my.site 上访问它)

我的 /etc/hosts 中的 80 端口上有 phpmyadminhttp://phpmyadmin 所以它只能在本地机器上访问

Emby Server 也安装在端口 8096 上(我可以访问这个 LAN 或 WAN)Webmin 安装在端口 10000 上(我可以访问这个 LAN 和 WAN)

如果我从 WAN 访问 my.site,则会出现 emby-server 页面,而 WP 网站应该出现该页面。如果我卸载 emby-server,则会出现 ERR_CONNECTION_REFUSED

但是,如果我从我的网络内部访问 my.site,无论是否安装了 emby,wordpress 网站都会加载。

更多信息

nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

# nginx configuration
#location / {
#rewrite ^/([_0-9a-zA-Z- ]+/)?wp-admin$ /$1wp-admin/ redirect;
#if (-e $request_filename){
#rewrite ^/([_0-9a-zA-Z- ]+/)?(wp-(content|admin|includes.*) /$2 break;
#}
#rewrite ^/([_0-9a-zA-Z- ]+/)?(.*\.php$ /$2 break;
#rewrite ^(.*)$ /index.php break;
#}

#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

/etc/nginx/sites-enabled/default

server {
        listen       80;
        server_name  my.site;
        root /var/www/my.site/public/;

        location / {
                try_files $uri $uri/ =404;
    }

        index index.php index.html;
        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /var/www/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}
server {
        listen       80;
        server_name  phpmyadmin;
        root /usr/share/phpmyadmin/;
        index index.php index.html;

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /var/www/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

请求的信息

$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target   prot opt source     destination

Chain FORWARD (policy ACCEPT)
target   prot opt source     destination

Chain OUTPUT (policy ACCEPT)
target   prot opt source     destination
$

答案1

我不知道为什么,但添加 8096 的防火墙规则解决了这个问题。

我现在可以访问 my.site 上安装的 WP 以及 my.site:8096 上的媒体浏览器

相关内容