【问题标题】:Can't get Baikal running in a subdirectory无法让 Baikal 在子目录中运行
【发布时间】:2014-02-25 16:47:29
【问题描述】:

我尝试使用“常规软件包”将Baïkal 安装在专用主机上。我正在使用 Nginx 作为网络服务器,但我无法让它运行。官方docs 仅专用于在子域(http://baikal.mydomain.com)上运行 Baikal,而不是在子目录(http://mydomain.com/baikal)中运行。当我打开http://mydomain.com/baikal/card.php/addressbooks/IstMe/default/ 时,我只得到一个“找不到文件”。任何帮助将不胜感激。

我的 nginx.conf 看起来像这样:

location /baikal {
    alias /usr/share/webapps/baikal/html;
    index index.php;
    rewrite ^/.well-known/caldav /cal.php redirect;
    rewrite ^/.well-known/carddav /card.php redirect;

    location ~ ^/baikal/(.+\.php)$ {
        alias /usr/share/webapps/baikal/html/$1;
        fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi.conf;
    }
}

location ~* /baikal/(\.ht|Core|Specific) {
    deny  all;
    return 404;
}

【问题讨论】:

  • 您找到解决方案了吗?
  • 很遗憾没有:-\

标签: php nginx caldav carddav


【解决方案1】:

我也遇到了同样的问题。以下来自this article 的非常简单的实例配置对我来说非常有用:

server {
    listen       [::]:443 ssl;
    server_name  yourdomain.tld;

    root  /usr/share/nginx/baikal/html;
    index index.php;

    ssl_certificate      server.crt;
    ssl_certificate_key  server.key;

    ssl_session_timeout  5m;

    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    rewrite ^/.well-known/caldav /cal.php redirect;
    rewrite ^/.well-known/carddav /card.php redirect;

    charset utf-8;

    location ~ /(\.ht|Core|Specific) {
        deny all;
        return 404;
    }

    location ~ ^(.+\.php)(.*)$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include        fastcgi_params;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

【讨论】:

    【解决方案2】:

    相当老的帖子,但我被重定向到这里寻找解决同样问题的方法^^
    这是一个关于这个问题和可能的解决方案的post
    这是NGINX的配置(这是剪切和粘贴,不是我的工作):

    location ^~ /baikal { # triggers location of baikal installation, and stop looking for other matches
      index index.php;
      charset utf-8; 
    
      # curiosity killed the cat 
      location ~ ^/baikal/(?:\.ht|Core|Specific) {
        deny all;
      }
    
      # this corresponds to the recommended regex for matching php files
      # and piping it to php-fpm
      location ~ ^(.+\.php)(.*) {
        try_files $fastcgi_script_name =404;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        include fastcgi_params;
      }
    
      # case insensitive matching of static files for maximum caching time
      location ~* \.(?:jpg|gif|ico|png|css|js|svg)$ {
        expires max; add_header Cache-Control public;
      }
    }
    

    我使用 apache,所以我无法对其进行测试,但这是我用来解决我的 Web 服务器上的问题的起点。

    【讨论】:

      【解决方案3】:

      您是否尝试过像这样从根目录创建 2 个符号链接到 html 目录:

      cd /var/www/baikal
      sudo ln -s  html/card.php card.php
      sudo ln -s  html/cal.php cal.php
      

      应该给出那个结果:

      ls -lah /var/www/baikal
      total 72K
      drwxrwxr-x  6 www-data www-data 4,0K nov.  19 12:40 .
      drwxr-xr-x 25 www-data www-data 4,0K nov.  19 12:54 ..
      lrwxrwxrwx  1 root     root       12 nov.  19 12:40 cal.php -> html/cal.php
      lrwxrwxrwx  1 root     root       13 nov.  19 12:40 card.php -> html/card.php
      

      这似乎适用于我的安装。

      【讨论】:

        猜你喜欢
        • 2014-11-11
        • 2013-04-21
        • 2014-05-07
        • 2014-06-18
        • 1970-01-01
        • 2012-02-03
        • 2015-06-13
        • 1970-01-01
        • 2019-02-27
        相关资源
        最近更新 更多