php - 无法让贝加尔在子目录中运行

标签 php nginx caldav carddav

我尝试安装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;
}

最佳答案

我也遇到了同样的问题。以下非常简单的实例配置来自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;
    }
}

关于php - 无法让贝加尔在子目录中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22020754/

相关文章:

javascript - 根据空闲/忙碌调用更改图像

php - Laravel:我们可以在以前的版本中使用最新版本的服务吗

redirect - NGINX:仅根据特定 URL 的 cookie 重定向用户

angular - Angular + Kubernetes + Nginx上的路由问题

http - WebDAV 属性即使在设置之后也会在请求中返回

PHP表单未提交,仅使用PDO准备好的语句获取空白页

适用于 IE7 和 iE8 的 PHP Ajax 缓存

ubuntu - 如何更改 nginx hls 文件的名称?

xml - CalDav Propfind 响应中的日期格式 - 如何更改它?

ios - iOS 内置日历应用程序如何与各种日历源同步?