nginx 在使用非标准端口和端口转发时将路径重定向到 url 参数

问题描述 投票:0回答:0

我的家庭路由器配置为使用端口转发,以便公共端口 8080 和 8443 分别使用私有端口 80 和 443 发送到另一台运行 nginx 并具有以下虚拟主机的机器。我本以为会请求 https://testing.example.com:8443/bla 来填充

$_GET
一些东西,但它是空的,只有一个请求 https://testing.example.com:8443/ ?bla=123 设置
$_GET
(即本例中的
Array ( [bla] => 123 )
)。这与端口转发的使用有什么关系,还是我的虚拟主机配置文件有问题?谢谢

server {
        server_name testing.example.com;
        root /var/www/testing/public;
        index index.php index.html index.htm;
        access_log /var/log/nginx/testing-access.log;
        error_log /var/log/nginx/testing-error.log;

        location / {
                #try_files $uri $uri/ /index.php$args;
                try_files $uri $uri/ /index.php$is_args$args;
        }
  
        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php8.1-fpm-facdocs.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
        }

        listen [::]:443 ssl; # managed by Certbot
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/testing.example.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/testing.example.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
        if ($host = testing.example.com) {
                return 301 https://$host$request_uri;
        } # managed by Certbot
        server_name testing.example.com;
        listen 80;
        listen [::]:80;
        return 404; # managed by Certbot
}
php nginx redirect portforwarding
© www.soinside.com 2019 - 2024. All rights reserved.