NginX reverse proxy with iRedMail Apache2

sim4life nginx-forum at
Tue Apr 15 17:09:51 UTC 2014

On an empty VPS hosting (Ubuntu 13.10 x64), I managed to run the base
iRedMail installation with Apache2 and LDAP and my roundcubemail was
accessible at:  

then I installed NginX, shutdown Apache2, reconfigured iRedMail (without
adding any extra A record in the DNS entry) and managed to run it on NginX
base installation as well with roundcubemail accessible at:  

Now, I want to run NginX reverse proxy with the base iRedMail Apache2
installation with roundcubemail accessible at:  
and I'm kinda stuck with the following Apache2 config files:  

 Listen 8080


 <VirtualHost *:8080>  
   DocumentRoot /var/www/  

   Alias / "/usr/share/apache2/roundcubemail/"  
  <Directory "/usr/share/apache2/roundcubemail">  
     Options Indexes FollowSymlinks MultiViews  
     AllowOverride All  
     Order allow,deny  
     Allow from all  

and following NginX config file:  


 server {  
        listen 80 default_server;  
        listen [::]:80;  

        root /usr/share/nginx/html;
        index index.html index.htm index.php;


        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;

        location ~ /\.ht {
                deny all;

server {  
        listen 443 ssl;

        root /var/www;
        index index.html index.htm index.php;


        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_prefer_server_ciphers   on;

        location / {
                # Apache is listening here
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For

Hitting in browser:  
gives the usual `SSL Connection Error`.  
Kindly advise.

Posted at Nginx Forum:,249312,249312#msg-249312

More information about the nginx mailing list