首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >activecollab 5 nginx url重写无效

activecollab 5 nginx url重写无效
EN

Stack Overflow用户
提问于 2017-10-24 08:19:22
回答 2查看 921关注 0票数 9

我试图按照这里的说明安装Activecollab。

我的nginx的vhost配置是这里

代码语言:javascript
复制
server {
    listen *:80;
    server_name collab.example.com;
    access_log /var/log/nginx/ac.access.log;
    error_log /var/log/nginx/ac.error.log;

    set $root_path /usr/share/nginx/html/collabs/public;
    root $root_path;

    index index.html index.htm index.php router.php;
    charset utf-8;

    if (!-e $request_filename) {
        rewrite ^/assets/(.*)$ /assets/$1 last;
        rewrite ^/avatars/(.*)$ /avatars/$1 last;
        rewrite ^/wallpapers/(.*)$ /wallpapers/$1 last;
        rewrite ^/verify-existence$ /verify.php last;
        rewrite ^/proxy.php$ /proxy.php last;
        rewrite ^/api/v([0-9]*)/(.*)$ /api.php?path_info=$2&api_version=$1 last;
        rewrite ^$ /router.php last;
        rewrite ^(.*) /router.php?path_info=$1 last;
    }


    location ~ ^/(assets|avatars|wallpapers)/ {
        root $root_path;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }


    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_read_timeout 150;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }

}

nginx -V输出

nginx version: nginx/1.10.3 (Ubuntu) built with OpenSSL 1.0.2g 1 Mar 2016 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

我搞错了

错误- URL重写未启用。无效的URL重写检查响应:

任何帮助都是非常感谢的。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-11-04 09:45:33

正如在chat和teamviewer调试会话中讨论的那样。activecollab的REDIRECT_CHECKconfig.php中有一个标志。您需要通过在config中定义此名称来禁用此重定向。

代码语言:javascript
复制
define('REDIRECT_CHECK',false);

此外,您还应该更改nginx配置的以下部分

代码语言:javascript
复制
if (!-e $request_filename) {
    rewrite ^/assets/(.*)$ /assets/$1 last;
    rewrite ^/avatars/(.*)$ /avatars/$1 last;
    rewrite ^/wallpapers/(.*)$ /wallpapers/$1 last;
    rewrite ^/verify-existence$ /verify.php last;
    rewrite ^/proxy.php$ /proxy.php last;
    rewrite ^/api/v([0-9]*)/(.*)$ /api.php?path_info=$2&api_version=$1 last;
    rewrite ^$ /router.php last;
    rewrite ^(.*) /router.php?path_info=$1 last;
}

代码语言:javascript
复制
location / { 
  if (!-e $request_filename) { 
     rewrite ^/assets/(.*)$ /assets/$1 last; 
     rewrite ^/avatars/(.*)$ /avatars/$1 last; 
     rewrite ^/wallpapers/(.*)$ /wallpapers/$1 last; 
     rewrite ^/verify-existence$ /verify.php last; 
     rewrite ^/proxy.php$ /proxy.php last; 
     rewrite ^/api/v([0-9]*)/(.*)$ /api.php?path_info=$2&api_version=$1 last; 
     rewrite ^$ /router.php last; 
     rewrite ^(.*) /router.php?path_info=$1 last; 
   } 
   try_files $uri $uri/ /router.php?path_info=$uri&$args; 
}
票数 2
EN

Stack Overflow用户

发布于 2017-11-02 01:56:47

塔伦的帮助下,我设法解决了这个问题。我们所做的是

  1. 确认这与nginx和规则无关
  2. 在配置文件中禁用REDIRECT_CHECK。

现在看来一切都很顺利。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46905460

复制
相关文章

相似问题

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