NGINX代理civiCRM容器出现静态文件问题

时间:2018-10-05 23:05:47

标签: php docker nginx drupal civicrm

我有一个运行Nginx的VPS,并且已经克隆了这个civiCRM项目:

https://github.com/altsalt/civicrm-docker.git

现在,我希望我的NGINX(不在容器中)将请求代理到nginx(在容器中),并且此请求将fastcgi_pass传递到应用程序。

我的NGINX CONFIG是

server {
    # Server name being used (exact name, wildcards or regular expression)
    server_name www.compucorpe.tk compucorpe.tk


    # Logging
    error_log /var/log/compucorpe.error_log;
    access_log /var/log/compucorpe.acess_log;

    location / {
            proxy_pass         http://127.0.0.1:8080;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;
            proxy_set_header   X-Forwarded-Proto $scheme;
            #proxy_redirect     http://127.0.0.1:8081 https://www.compucorpe.tk;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/www.compucorpe.tk/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/www.compucorpe.tk/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}


server {
    if ($host = compucorpe.tk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = www.compucorpe.tk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name www.compucorpe.tk compucorpe.tk


    # Logging
    error_log /var/log/compucorpe.error_log;
    return 404; # managed by Certbot

PHP FPM容器似乎可以正常工作,但是当我想安装Drupal时,如图所示,我没有任何静态文件

with proxy_set_header Host

如果我评论    proxy_set_header主机$ host;

如我们所见,浏览器尝试从用于传递(127.0.0.1:8080)的ip获取文件

Host commented

这里有什么想法吗?

我是Drupal的新手,我见过有人在编辑drupal settings.php 并激活代理。我已经做到了:

$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array($proxy_ip)

我必须重新启动Drupal吗?它与php-fpm一起运行,所以我认为这是不必要的。

0 个答案:

没有答案