Rainloop不与使用NGINX的虚拟主机一起工作

时间:2017-09-22 07:21:07

标签: php nginx webmail

我试图从虚拟主机调用我的rainloop实例但是使用子目录。

rsanchez@babylon:/etc/nginx/vhosts$ more rainloop.conf 
location ^~ /webmail {
    root /srv/rainloop/public_html;
    try_files $uri $uri/ /webmail/index.php?$query_string;
    #if (!-e $request_filename) { rewrite ^ /webmail/index.php last; }
    access_log /srv/rainloop/logs/access.log;
    error_log /srv/rainloop/logs/error.log;
    index index.php;
    access_log /var/log/nginx/scripts.log scripts;

    location ~ \.php$ {
        #if (!-f $request_filename) { return 404; }
        include fastcgi_params;
        #fastcgi_split_path_info ^(.+\.php)(/.+)$; #this line
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_FILENAME /srv/rainloop/public_html/index.php;
    }

    location ~ /\.ht {
        deny all;
    }

    location ^~ /webmail/data {
        deny all;
    }

    #location ~ /webmail/\.css {
    #    root /srv/rainloop/public_html;
    #    add_header  Content-Type    text/css;
    #}

    #location ~ /webmail/\.js {
    #    root /srv/rainloop/public_html;
    #    add_header  Content-Type    application/x-javascript;
    #}
}

主文件是/ etc / nginx / sites-available / default。从这里我调用上面的代码。

upstream zboss {
        server unix:/srv/zboss/run/zboss.sock fail_timeout=0;
}

server {
        listen 80 default_server;
        server_name babylon;
        root /var/www/html;

        location / {
                root /var/www/html;
                index index.html;
        }

        location /static {
                alias /srv/zboss/static;
        }

        location /prot/media {
                alias /var/www/uploads/zboss/;
        }

        location = /favicon.ico { access_log off; log_not_found off; }
        location /prot {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header SCRIPT_NAME /prot;
                proxy_redirect off;
                if (!-f $request_filename) {
                        proxy_pass http://zboss;
                        break;
                }
        }

        location /wiki { 
                include uwsgi_params;
                uwsgi_param SCRIPT_NAME /wiki;
                #uwsgi_pass unix:///usr/local/share/moin/moin.sock;
                uwsgi_pass 127.0.0.1:8080;
                uwsgi_modifier1 30;
        }

        location /cgit {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass http://127.0.0.1:85;
        }

        include vhosts/*.conf;
}

尝试http://babylon/webmail时,我会看到一个空白页面。检查代码我发现我的代码无法加载http://babylon/rainloop/v/1.10.5.192/static/js/min/boot.min.js?standard

当我看到nginx日志时,我发现:

2017/09/21 15:32:08 [error] 1737#0: *31774 open() "/var/www/html/rainloop/v/1.10.5.192/static/js/min/boot.min.js" failed (2: No such file or directory), client: 192.168.224.8, server: babylon, request: "GET /rainloop/v/1.10.5.192/static/js/min/boot.min.js?standard HTTP/1.1", host: "babylon", referrer: "http://babylon/webmail"

但是," /var/www/html/rainloop/v/1.10.5.192/static/js/min/boot.min.js"不是真正的位置。真正的位置是" /srv/rainloop/public_html/rainloop/v/1.10.5.192/static/js/min/boot.min.js"

我真正的问题是改变:/ var / www / html / / srv / rainloop / public_html /

如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

  

我真正的问题是改变:/ var / www / html / srv / rainloop / public_html /
  如何解决这个问题?"

尝试转换" html"成为指向/ srv / rainloop / public_html的符号链接

答案 1 :(得分:0)

将评论作为答案发布,因为我需要格式化

尝试将以下块添加到您的配置

location /rainloop/ {
   alias /srv/rainloop/public_html/rainloop/;
}