【发布时间】:2018-12-20 16:54:45
【问题描述】:
我们已经设置了一个反向代理 Nginx 来将请求重定向到正确的 Web 服务容器。
配置 Nginx 反向代理:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name weblab.mhf.mhc;
client_max_body_size 200M;
location /client_portal/ {
resolver 127.0.0.11 ipv6=off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://client_portal;
access_log /var/log/nginx/client_portal.access.log;
error_log /var/log/nginx/client_portal.error.log;
}
}
网站 client_portal 由另一个使用 Apache 作为 Web 服务器的容器托管。
配置 Apache 客户端门户:
<VirtualHost *:80>
ServerAdmin toto@toto.com
ServerName weblab.mhf.mhc
DocumentRoot /srv/www/
ErrorLog ${APACHE_LOG_DIR}/client_portal.error.log
CustomLog ${APACHE_LOG_DIR}/client_portal.access.log combined
<Location "/client_portal">
AllowOverride All
Require all granted
</Location>
</VirtualHost>
当我导航到 https://weblab.mhf.mhc/client_portal 时,首页使用此配置正确加载,但重定向被破坏。如果我转到https://weblab.mhf.mhc/client_portal/user/login,我会收到 404 错误。 我也试过这个配置(在生产中使用),但首页没有正确加载(所有 css/js 文件都坏了):
<VirtualHost *:80>
ServerAdmin toto@toto.com
ServerName weblab.mhf.mhc
DocumentRoot /srv/www/
ErrorLog ${APACHE_LOG_DIR}/client_portal.error.log
CustomLog ${APACHE_LOG_DIR}/client_portal.access.log combined
<Directory /srv/www/client_portal>
Options -Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
我尝试将 apache 切换到 nginx 并使用 nginx 的官方 drupal 8 配置 (https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/) 但我遇到了同样的问题。请问配置有什么问题?
【问题讨论】:
标签: docker drupal-8 apache2.4 nginx-reverse-proxy