Laravel Octane 与 Swoole HTTPS 配置 apache vhost 代理错误

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

我正在尝试为我的 Laravel 11 网站设置 SSL,该网站通过 Laravel Octane 运行。我正在使用

swoole
,已生成让我们加密 ssl 证书,并在我的辛烷配置文件中将
swoole.ssl
设置为 true。当我启动我的 Octane 服务器并访问我的域的 http 变体时,我会收到 502 代理错误,如果我尝试访问 https 变体,我只会收到一般浏览器错误。为了通过 https 为我的网站提供服务,我的 apache 虚拟主机中缺少什么:

<VirtualHost *:80>
    ProxyPreserveHost On

    ProxyPass / http://127.0.0.1:8000/
    ProxyPassReverse / http://127.0.0.1:8000/

    ServerName my-site.domain.com
    ServerAdmin admin@localhost
    DocumentRoot /var/www/icicle/current/public;

    <Directory /var/www/icicle/current/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    ServerName my-site.domain.com
    ServerAdmin admin@localhost
    DocumentRoot /var/www/icicle/current/public

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/my-site.domain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/my-site.domain.com/privkey.pem

    ProxyPreserveHost On

    ProxyPass / http://127.0.0.1:8000/
    ProxyPassReverse / http://127.0.0.1:8000/

    <Directory /var/www/icicle/current/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

我已将以下内容添加到我的辛烷配置文件中:

'swoole' => [
    'ssl' => true,
    'options' => [
        'ssl_cert_file' => '/etc/letsencrypt/live/my-site.domain.com/cert.pem',
        'ssl_key_file' => '/etc/letsencrypt/live/my-site.domain.com/privkey.pem',
    ]
],
laravel lets-encrypt vhosts swoole laravel-octane
1个回答
0
投票

只需正确配置Web服务器即可,无需在swoole中设置证书信息。

© www.soinside.com 2019 - 2024. All rights reserved.