首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rainloop无法与带有NGINX的virtualhost一起使用

Rainloop无法与带有NGINX的virtualhost一起使用
EN

Stack Overflow用户
提问于 2017-09-22 15:21:07
回答 2查看 521关注 0票数 0

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

代码语言:javascript
复制
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。从这里我调用上面的代码。

代码语言:javascript
复制
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日志时,我发现:

代码语言:javascript
复制
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 for /srv/rainloop/public_html/

如何解决这个问题?

EN

回答 2

Stack Overflow用户

发布于 2018-02-28 15:02:29

我真正的问题是修改: /var/www/html for /srv/

/public_html/

如何解决这个问题?“

正在尝试将"html“转换为指向/srv/rainloop/public_html的符号链接

票数 2
EN

Stack Overflow用户

发布于 2017-09-22 15:42:15

当我需要格式化时,发布评论作为回答

尝试将下面的块也添加到您的配置中

代码语言:javascript
复制
location /rainloop/ {
   alias /srv/rainloop/public_html/rainloop/;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46359003

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档