我正在运行roundcube webmail通过一个nginxnetworking服务器,只提供http。
这是由另一个服务https的nginx代理。
两者在同一台机器上都是独立的FreeBSD jail。
我基本上可以通过代理的地址访问roundcube网页,但是一些function不起作用。 例如:
有没有人有线索可能是这里的问题? 具有相同设置的相同代理对我自己的云实例工作得很好。
当我通过代理login时select一条消息时,两个nginx实例的错误日志都不显示任何条目。
但是,在select中间没有代理的消息时,我在access.log中看到以下日志:
10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview HTTP/1.1" 200 11236 "http://10.0.0.211/?_task=mail&_mbox=INBOX" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /skins/larry/styles.min.css?s=1448290416 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /skins/larry/mail.min.css?s=1448290416 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /plugins/jqueryui/themes/larry/jquery-ui-1.10.4.custom.css?s=1448290415 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /skins/larry/ui.min.js?s=1448290416 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /program/js/jquery.min.js?s=1448290416 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /program/js/common.min.js?s=1448290416 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /program/js/app.min.js?s=1448290416 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /plugins/jqueryui/js/jquery-ui-1.10.4.custom.min.js?s=1448290415 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" 10.0.0.25 - - [05/Jan/2016:14:03:22 +0100] "GET /plugins/jqueryui/js/i18n/jquery.ui.datepicker-de.js?s=1448290415 HTTP/1.1" 304 0 "http://10.0.0.211/?_task=mail&_caps=pdf%3D1%2Cflash%3D1%2Ctif%3D0&_uid=44613&_mbox=INBOX&_framed=1&_action=preview" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"
当我点击消息与之间的代理,两个nginx实例的访问日志显示没有新条目。
这可能暗示我的configuration可能是错误的吗?
这里是我的nginxconfiguration:
圆形监狱的nginx:
worker_processes 2; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { #listen 80; root /usr/local/www/roundcubemail; # Logs access_log /usr/home/webmail/roundcube-access.log; error_log /usr/home/webmail/roundcube-error.log; # Default location settings location / { index index.php; try_files $uri $uri/ /index.php?$args; } # Redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # Pass the PHP scripts to FastCGI server (locally with unix: param to avoid network overhead) location ~ \.php$ { # Prevent Zero-day exploit try_files $uri =404; fastcgi_keep_conn on; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # Deny access to .htaccess files, if Apache's document root location ~ /\.ht { deny all; } # Exclude favicon from the logs to avoid bloating when it's not available location /favicon.ico { log_not_found off; access_log off; } } }
代理监狱的nginx:
worker_processes 2; error_log /usr/local/etc/nginx/proxy.error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; return 301 https://$host$request_uri; } server { listen 443; server_name mydomain.tld; ssl_certificate /usr/local/etc/nginx/server.crt; ssl_certificate_key /usr/local/etc/nginx/server.key; ssl on; ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff; ssl_session_tickets off; # Requires nginx >= 1.5.9 resolver_timeout 5s; access_log /usr/local/etc/nginx/proxy.access.log; location ^~ /owncloud { proxy_set_header X-Forwarded-Host mydomain.tld; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://10.0.0.202:80/owncloud; proxy_redirect http:// https://; client_max_body_size 2G; } location ^~ /mail { proxy_set_header X-Forwarded-Host mydomain.tld; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://10.0.0.211:80/; proxy_redirect http:// https://; } } }
我find了soloution!
在代理configuration中,行
add_header X-Frame-Options DENY;
造成危害。
如果我把它评论出来,一切正常。
与我在其他资源中find的不同,选项$config['x_frame_options'] = 'sameorigin';
在roundcube的defaults.inc.php中可以保持其默认值,不需要更改为false。
也许这有助于在未来有人类似的问题。
您的代理不透明,它将邮件服务器上的/mail/xxx
等URI翻译为/xxx
。
查看您的access.log
,网页包含/skins
, /plugins
和/program
下的embedded式资源。 当通过代理访问这些资源时,没有规则将请求发送到邮件服务器。 因此,您的网页不完整。
最简单的解决scheme可能是使您的代理对邮件服务器透明,因为您声明自己的云代理正在工作。 尝试:
location /owncloud { # owncloud proxy } location / { # mail proxy }
所以所有的URI将被透明地传递给邮件服务器,除了那些专门针对自己的云服务的URI。