2

/etc/nginx/sites-available/x.x.x.x.conf,我有这个条目:

   location /myapp {
       alias /var/www/html/myapp/public;
       index index.php;
       try_files $uri $uri/ @myapp;
 
       location ~* \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename$fastcgi_script_name;
                fastcgi_read_timeout 7200;
       }
 
   }
 
   location @myapp {
             rewrite /myapp/(.*)$ /myapp/index.php?/$1 last;
   }

目前我访问我的网站到 xxxx/myapp

如何将其代理到 xxxx:8059?

4

1 回答 1

1

我不确定我是否理解你的问题。为什么不发布他们的服务器块?我还是试试:

    location /myapp/
    {
        proxy_pass http://x.x.x.x:8059/;
    }

或者反过来:

server
{
    listen 8059;
    server_name x.x.x.x example.org www.example.org;

    # …

    location /
    {
        proxy_pass http://x.x.x.x:80/myapp/;
    }
}

现在很容易发生您的路径被破坏的情况。在代码中更改它们或签出proxy_redirectsub(s)_filter进行即时更改。

浏览器 -> 键 [F12] -> 控制台和/或网络总是有帮助的。

在 Windows 上也不错:安装 Git,打开 Git Bash 并执行curl -IL <URL>.

于 2021-03-27T15:13:32.687 回答