我尝试安装 baikal。运行完美,配置、网站完美。但是当我尝试获取我的书籍时,我收到此错误:
2016/12/24 10:21:40 [error] 6440#0: *7 "/var/www/mail/dav/html/dav.php/addressbooks/index.html" is not found (20: Not a directory), client: 46.223.1.8, server: dav.mailgermania.de, request: "GET /dav.php/addressbooks/ HTTP/1.1", host: "dav.mailgermania.de", referrer: "https://dav.mailgermania.de/dav.php"
这是我的 nginx 配置
server {
listen 80;
listen [::]:80;
server_name dav.mailgermania.de
server_tokens off;
root /var/www/mail/dav/html;
return 301 https://$host$request_uri;
}
server {
listen 443;
listen [::]:443;
server_name dav.mailgermania.de
server_tokens off;
ssl on;
ssl_certificate /etc/ssl/mail/mail.crt;
ssl_certificate_key /etc/ssl/mail/mail.key;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128- GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_dhparam /etc/ssl/mail/dhparams.pem;
add_header Strict-Transport-Security max-age=15768000;
ssl_session_timeout 30m;
client_max_body_size 25m;
root /var/www/mail/dav/html;
index index.html index.htm index.php;
add_header X-Frame-Options "SAMEORIGIN";
add_header Content-Security-Policy "frame-ancestors 'self';";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
rewrite ^/.well-known/caldav /dav.php redirect;
rewrite ^/.well-known/carddav /dav.php redirect;
charset utf-8;
location ~ /(.ht|Core|Specific) {
deny all;
return 404;
}
location ~ .php$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php-mail-fpm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 630;
fastcgi_keep_conn on;
}
}
我不知道这个错误意味着什么,也许你能帮助我?
感谢帮助
更新 我像这样更改了我的 php 块:
location ~ ^(.+\.php)(.*)$ {
try_files $fastcgi_script_name =404;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_param HTTPS on;
fastcgi_read_timeout 630;
fastcgi_keep_conn on;
}
现在它起作用了。谢谢。
答案1
您想要try_files
向您的 PHP 处理位置添加一个块:
location ~ .php$ {
try_files $uri $uri/ $uri/index.php;
...
}
这将为 nginx 提供一系列要尝试的不同操作,以尝试找到要运行的正确 URI。