gpt4 book ai didi

php - Roundcube - Nginx 不会自动重定向到 .php 文件

转载 作者:太空宇宙 更新时间:2023-11-03 13:53:36 36 4
gpt4 key购买 nike

已编辑!

我使用 Nginx、Postfix、Postfixadmin、Dovecot 和 Roundcube 在 Debian 7 上设置了一个邮件服务器。

我尝试创建一个别名以使用我的域 example.org(当然,这里的域是示例)的 SSL 证书用于 web 邮件。访问以下 URL 时 https://example.org/support/webmail/ - Nginx 没有重定向到 index.php 文件,我收到以下消息 403 Forbidden。仅当我在 URL 末尾手动添加 .php 文件时它才有效。

这是我的配置:

server {
listen 80;
server_name example.org;
return 301 https://$server_name$request_uri;
}

server {
listen 80;
server_name www.example.org;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
ssl on;

server_name example.org;
root /var/www/soon;

server_tokens off;

ssl_certificate /etc/ssl/certs/example.org.certchain.crt;
ssl_certificate_key /etc/ssl/private/example.org.key;

ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;
ssl_prefer_server_ciphers on;

# HSTS
add_header Strict-Transport-Security max-age=15768000;

location /support/webmail/ {
alias /var/www/webmail/;
autoindex off;

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
# include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
}

谢谢。 :)

最佳答案

已解决。

这是适合我的配置:

server {
listen 80;
server_name example.org;
return 301 https://$server_name$request_uri;
}

server {
listen 80;
server_name www.example.org;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
ssl on;

server_name example.org;
root /var/www/soon;

server_tokens off;

ssl_certificate /etc/ssl/certs/example.org.certchain.crt;
ssl_certificate_key /etc/ssl/private/example.org.key;

ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;
ssl_prefer_server_ciphers on;

# HSTS
add_header Strict-Transport-Security max-age=15768000;

location /support/webmail/ {
alias /var/www/webmail/;
autoindex off;
index index.php;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
}

关于php - Roundcube - Nginx 不会自动重定向到 .php 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30901389/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com