我用Nginx在Debian Stretch上新鲜安装了Roundcube,并且在带有/ webmail或domain / webmail的IP地址上可以正常工作。但是,正如我试图让它在Domain php的根目录上运行时,PHP提供的文件为Download。如何在域的根目录上访问它?
这是我的Nginx配置,将不工作,并且我将PHP文件下载为
server {
listen *:80;
listen *:443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /var/www/clients/client0/web1/ssl/xxxxl.de.crt;
ssl_certificate_key /var/www/clients/client0/web1/ssl/xxxx.de.key;
server_name xxx.de ;
root /usr/share/roundcube;
index index.html index.htm index.php index.cgi index.pl index.xhtml;
location / {
try_files $uri $uri/ index.php;
}
location ~ ^/(bin|SQL|config|temp|logs)/ {
deny all;
}
location ~* \.php$ {
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
# To access SquirrelMail, the default user (like www-data on Debian/Ubuntu) must be used
fastcgi_pass unix:/var/lib/php7.0-fpm/apps.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
但是如果我将int放在目录中(将根目录更改为/ usr / share /并添加下面的代码),我将获得对Roundcube的访问权限
location /{
location ~ ^/roundcube/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
# To access SquirrelMail, the default user (like www-data on Debian/Ubuntu) must be used
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/lib/php7.0-fpm/apps.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
```
How can i access Roundcube directly from the root of the TLD?
答案 0 :(得分:0)
好的,这里的分辨率。有点奇怪,但这是带有缓存的Chrome Bug!当我确实设置VHOST.conf时,我可能出错了,并且PHP文件已在Chrome中下载。出于未知原因,Chrome缓存在几天之内没有刷新,他一次又一次地为我提供了下载。解决方案是清除Chromes缓存/使用其他浏览器。我不会更深入地研究chrome,并检查为什么在这种特殊的下载情况下chrome不会刷新缓存。