我尝试使用“常规包”在专用主机上安装Baïkal。我使用 Nginx 作为网络服务器,但无法运行它。官方docs仅致力于在子域(http://baikal.mydomain.com)上运行贝加尔湖,而不是在子目录(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;
}
我也遇到了同样的问题。 本文中的以下非常简单的实例配置对我来说非常有用:
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;
}
}
相当旧的帖子,但我已被重定向到这里寻找同一问题的解决方案^^
有一篇关于此问题的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,所以我无法测试它,但这是我用来解决网络服务器问题的起点。
您是否尝试过创建 2 个从 root 到 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
这似乎适用于我的安装。
我知道我已经迟到了。但我在子目录中搜索贝加尔湖的安装时发现了这个问题。不幸的是,我找不到任何其他资源来解释如何执行此操作。但当我终于设法让它工作时,我想分享解决方案以供将来参考。
我使用当前的Baikal文档作为起点,并使用子目录“baikal”进行这样的修改:
# Route well-known addresses to subdirectory
rewrite ^/.well-known/caldav /baikal/dav.php redirect;
rewrite ^/.well-known/carddav /baikal/dav.php redirect;
# Handle all Baikal-related requests here
location /baikal/ {
# Baikal HTML root directory, mind the trailing slash
alias /baikal/installation/baikal/html/;
index index.php;
charset utf-8;
# The HTML base directory does not contain 'Core', 'Specific', etc.
# directories, so the location block for blocking those is omitted.
# Handle all PHP files (removed the RegExp captures)
location ~ \.php {
try_files $fastcgi_script_name = 404;
include fastcgi_params;
# Ensure to remove the subdirectory name from the PHP call
fastcgi_split_path_info ^/baikal(.+\.php)(.*)$;
fastcgi_pass php-handler;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
此配置可以插入到现有的 Nginx 服务器配置块中。重新启动服务器后,贝加尔湖管理工作正常。
但是当指向 CardDav/CalDav URI 时,我收到以下错误消息:
Requested uri (/baikal/dav.php) is out of base uri (/dav.php/)
在网上和管理设置中搜索后,我扫描了源代码,终于找到了配置设置,负责调整基本URI:
base_uri: 'baikal'
该变量默认设置为
''
,必须更改以匹配新的子目录。该设置可以在文件中找到config/baikal.yaml
。