nginx + apache2 + php-fpm - 奇怪的服务器端口

nginx + apache2 + php-fpm - 奇怪的服务器端口

我将 nginx 作为 apache2 + php5-fpm 的代理。我决定添加 letsencrypt 证书以使用 https。我在 nginx 中重新配置了我的 vhost,并编辑了 apache2 配置。一切似乎都运行正常,除了一件事 - 出于某种原因_SERVER["SERVER_PORT"]显示 80,我不知道它来自哪里。

我的配置:

NGINX

server
{
    server_name domain.com www.domain.com;
    listen 80;
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
    add_header Strict-Transport-Security "max-age=31536000" always;

    charset utf-8;
    disable_symlinks if_not_owner from=$root_path;
    set $root_path /var/www/flyer/data/www/domain.com;
    if ($scheme = http) {
    return 301 https://$server_name$request_uri;

    }
    location ~* ^.+\.(html|jpg|ico|jpeg|gif|txt|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$
    {
        root $root_path;
        error_page 404 = @fallback;
    }
    location /
    {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        root $root_path;
    }
    location @fallback
    {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

亚太地区2

<Directory /var/www/flyer/data/www/domain.com>
    Options -ExecCGI -Includes
    Require all granted
    AllowOverride All
</Directory>
<VirtualHost 127.0.0.1:8080 >
    ServerName domain.com
    Options -Indexes
    SetEnvIf X-Forwarded-Proto https HTTPS=on
    CustomLog /var/www/flyer/data/logs/domain.com.access.log combined
        DocumentRoot /var/www/flyer/data/www/domain.com
        ErrorLog /var/www/flyer/data/logs/domain.com.error.log
        ServerAdmin [email protected]
        ServerAlias www.domain.com
    ProxyPassMatch ^/(.*\.php(/.*)?)$ unix://var/run/phpfpm_domain_com.sock|fcgi://localhost/var/www/flyer/data/www/domain.com/
</VirtualHost>

php信息

_SERVER["HTTP_X_FORWARDED_PROTO"]   https
_SERVER["HTTP_CONNECTION"]  close
_SERVER["HTTP_UPGRADE_INSECURE_REQUESTS"]   1
_SERVER["SERVER_NAME"]  domain.com
_SERVER["SERVER_ADDR"]  127.0.0.1
_SERVER["SERVER_PORT"]  80
_SERVER["REQUEST_SCHEME"]   http
_SERVER["GATEWAY_INTERFACE"]    CGI/1.1
_SERVER["SERVER_PROTOCOL"]  HTTP/1.1

问题是,这个 80 端口从何而来,为什么我没有得到任何帮助?

相关内容