lsky-org / lsky-pro

☁️兰空图床(Lsky Pro) - Your photo album on the cloud.
https://www.lsky.pro
GNU General Public License v3.0
3.92k stars 582 forks source link

结合frp,如何修改login和register的链接地址 #745

Open jopees opened 7 months ago

jopees commented 7 months ago

Lsky-pro通过内网机器的nginx反代到8000端口,对局域网公开,然后通过frpc把内网的8000端口绑定到域名https://image.domain.com下面。 我修改了.env文件,添加了APP_URL和ASSET_URL参数,页面能够正常打开,所有的静态资源也能够加载。但是就“登录“按钮和“注册”按钮的链接有问题,“登录”按钮的链接是https://127.0.0.1:3459/login,“注册”按钮的链接是https://127.0.0.1:3459/register

APP_URL=http://image.domain.com
ASSET_URL=https://image.domain.com

曾经尝试但失败的方法1、:/app/Providers/ApServiceProvider.php`第 32 行下面追加\Illuminate\Support\Facades\URL::forceScheme('https'); 曾经尝试但失败的方法2、去掉ASSET_URL=https://image.domain.com

Nginx的配置:

server {
        listen 8000 default_server;
        root /www/webroot/lsky/public;

        index index.php index.html index.htm index.nginx-debian.html;
        server_name image.domain.com;

        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $remote_addr;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        location / {
                try_files $uri $uri/  /index.php?$query_string;
        }

        location ~* \.php$  {
                #internal;
                include        fastcgi_params;
                fastcgi_intercept_errors on;
                fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
}
mengtaixiao commented 5 months ago

不行,我也是这样发现不行 后来我找到怎么解决了,就是让frp的端口和反代的端口一样,就正常了

frp的https隧道(443端口)-->反代(监听全部来源的443端口) --> 127.0.0.8089 正常!

如果反代那里的端口和frp端口不一样 就会出问题