Nginx反向代理与iRedMail Apache2

在一个空的VPS主机上,我设法使用Apache2和LDAP运行基本的iRedMail安装,我的roundcubemail可以在以下地址访问:
https://www.mydomain.com/mail

然后我安装了NginX,closures了Apache2,重新configuration了iRedMail(在DNS条目中没有添加任何额外的Alogging),并设法在Nginx基础安装上运行它,以及可以在以下地址访问的roundcubemail:
https://mail.mydomain.com

现在,我想运行带有roundcubemail的基础iRedMail Apache2安装的Nginx反向代理,请访问:
https://mail.mydomain.com
我有点卡住下面的Apache2configuration文件:
/etc/apache2/ports.conf

听8080

/etc/apahce2/sites-available/my-iredmail.conf

<VirtualHost *:8080>
DocumentRoot / var / www /
ServerName mail.mydomain.com

别名/“/ usr / share / apache2 / roundcubemail /”
<Directory "/usr/share/apache2/roundcubemail">
选项索引FollowSymlinks MultiViews
AllowOverride全部
订单允许,否认
全部允许
</Directory>
</VirtualHost>

并遵循NginXconfiguration文件:

/etc/nginx/sites-available/default

服务器{
听80 default_server;
听[::]:80;

  root /usr/share/nginx/html; index index.html index.htm index.php; server_name mydomain.com www.mydomain.com mail.mydomain.com; location / { try_files $uri $uri/ /index.html; } location ~ \.php$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080/; } location ~ /\.ht { deny all; } 

}

服务器{
听443 ssl;

  root /var/www; index index.html index.htm index.php; server_name mydomain.com www.mydomain.com mail.mydomain.com; ssl on; ssl_certificate /etc/ssl/certs/iRedMail_CA.pem; ssl_certificate_key /etc/ssl/private/iRedMail.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; ssl_prefer_server_ciphers on; location / { # Apache is listening here proxy_pass http://127.0.0.1:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } 

}

打在浏览器中:
https://mail.mydomain.com给出了通常的SSL Connection Error
好心提醒。

你的问题在这里:

 location ~ \.php$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080/; } 

您不能在非静态的位置使用proxy_pass。 你应该反过来做。 列出应由nginx本地加载的内容,然后将该location /使用proxy_pass传递回Apache。