我在服务器上为子目录设置反向代理时遇到问题。
我有一个运行在端口3026
上的ReactJS应用程序,它是主应用程序,因此我将这些行添加到了conf文件中
ProxyPass / http://0.0.0.0:3025/
ProxyPassReverse / http://0.0.0.0:3025/
到目前为止,这很好,现在我想将laravel应用程序部署到子目录中,并使其可以通过http://0.0.0.0/video-call
进行访问,因此我执行了以下操作:
ProxyPass /video-call http://0.0.0.0/video-call/
ProxyPassReverse /video-call http://0.0.0.0/video-call/
但是当我使用浏览器导航时,出现此错误redirected too many times
我为apache2启用了代理模块,这是我在.htaccess
中的video-call/public
文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我还添加了sites-available/default-ssl.conf
<Directory /var/www/video-call/public>
AllowOverride All
</Directory>
我想我遵循了所有内容,但是这里肯定有我想念的东西。
如果您需要更多信息,请发表评论,我会为所有问题提供答案。