1 (edited by marius.cdm 2013-01-29 22:47:33)

Topic: Apache multiple virtual hosts

==== Required information ====
- iRedMail version: iRedMail-0.8.3.tar.bz2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CentOS 6.3
====

Hey guys,

I'm trying to achive 3 goals in my setup.

1. Disable /mail, /webmail, /roundcube for every new domain and subdomain
2. Redirect mail.example.com, mail.example1.com, mail.exampleX.com to where /mail was.
3. Redirect every domain and subdomain to it's related website. Not comon ofc.

My DNS records are up and running for the hosted domains, the question is what do i need to modify in Apache config to get it right?

I've tryed different examples, no luck so far.

Thank you!

2 (edited by marius.cdm 2013-01-30 00:49:16)

Re: Apache multiple virtual hosts

I managed to make some progress but now i can't access /phpmyadmin and /iredadmin.

This is what i got so far.

<VirtualHost *:80>
    ServerName www.domain.com
    ServerAlias domain.com
    DocumentRoot /var/www/html
    Options -MultiViews +FollowSymlinks -Indexes
</VirtualHost>

<VirtualHost *:80>
    ServerName mail.domain.com
    DocumentRoot /var/www/roundcubemail
    Options -MultiViews +FollowSymlinks -Indexes
</VirtualHost>


<VirtualHost *:443>
   ServerName mail.domain.com
   DocumentRoot /var/www/roundcubemail

   <Directory "/var/www/roundcubemail">
     Options -Indexes FollowSymlinks MultiViews
     AllowOverride All
     Order allow,deny
     Allow from all
   </Directory>

   ErrorLog logs/ssl_error_mail1_log
   TransferLog logs/ssl_access_mail1_log
   LogLevel warn
   SSLEngine on
   SSLProtocol all -SSLv2
   SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
   SSLCertificateFile /etc/pki/tls/certs/iRedMail_CA.pem
   SSLCertificateKeyFile /etc/pki/tls/private/iRedMail.key

   <Files ~ "\.(cgi|shtml|phtml|php3?)$">
      SSLOptions +StdEnvVars
   </Files>

   <Directory "/var/www/cgi-bin">
      SSLOptions +StdEnvVars
   </Directory>

   setEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

   CustomLog logs/ssl_request_mail1_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>


I finally managed to get it working for multiple domains. Just had to carefully separate general from targeted config found here
http://www.iredmail.org/forum/topic3907 … hosts.html

Thank you digitalbit!