#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    38
    Rep Power
    3

    Apache Virtual Host for subdomain


    Hi, I have an issue with Apache Virtual hosts. I installed a web server and mail server. Apache, PHP, MySQL and Postfix Dovecot ClamAV Amadis Spamassasin a RoundCube for Webmail on a Centos 6 box.

    Now, my issue is that I have my DNS like this:

    @ x.x.x.x A record
    www domain dot com CNAME
    webmail domain dot com CNAME



    Now, I can access my email via web using roundcube like this: (URL address blocked: See forum rules)

    However, when I try to access (URL address blocked: See forum rules) it redirects me to the default page when an index is not found.

    My Virtual host configuration is like this:

    Code:
    NameVirtualHost *:80
    
    <VirtualHost *:80>
    ServerName (URL address blocked: See forum rules)
    ServerAlias (URL address blocked: See forum rules)
    DocumentRoot /srv/www/domain dot com/public_html/
    ErrorLog /srv/www/domain dot com/logs/error.log
    CustomLog /srv/www/domain dot com/logs/access.log combined
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot /usr/share/roundcubemail
    ServerName webmail dot domain dot com
    </VirtualHost>
    I believe there is something with my vhost configuartion above, however, cant figure it out, since I have read a lot and all the vhost files seems to be exactly like mine. So, I can't get webmail dot domain dot com to go to my roundcube webmail and I ahve been fighting with this all day long.

    Can someone help me with this, if you need further information, please let me know. Also, even if I use http, it changes it to https... I generated self signed certificates for my email access. For apache SSL conf I have these lines:

    <VirtualHost _default_:443>

    # General setup for the virtual host, inherited from global configuration
    DocumentRoot "/var/www/html"
    ServerName (URL address blocked: See forum rules):443

    # Use separate log files for the SSL virtual host; note that LogLevel
    # is not inherited from httpd conf.
    ErrorLog logs/ssl_error_log
    TransferLog logs/ssl_access_log
    LogLevel warn


    Of course there is more, but I believe that info may be enough. Please, can someone help me with this?

    Sorry for the domain dot com but due to forum rules, since I am a new member I cant use URLs, so hope you understand. Regards.
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,068
    Rep Power
    9398
    I, for one, can't really tell what you're saying without those URLs. Yeah it's inconvenient, we know. How about doing the "www dot domain dot com" thing for those?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    38
    Rep Power
    3
    Originally Posted by requinix
    I, for one, can't really tell what you're saying without those URLs. Yeah it's inconvenient, we know. How about doing the "www dot domain dot com" thing for those?
    Thank you for your reply. thats what I did, if you see... instead of a . there is a dot
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,068
    Rep Power
    9398
    Originally Posted by jaimitoc30
    Thank you for your reply. thats what I did, if you see... instead of a . there is a dot
    For a couple, yes. But there's also
    Now, I can access my email via web using roundcube like this: (URL address blocked: See forum rules)

    However, when I try to access (URL address blocked: See forum rules) it redirects me to the default page when an index is not found.
    Code:
    ServerName (URL address blocked: See forum rules)
    ServerAlias (URL address blocked: See forum rules)
    Code:
    ServerName (URL address blocked: See forum rules):443
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    38
    Rep Power
    3
    Originally Posted by requinix
    For a couple, yes. But there's also

    Code:
    ServerName (URL address blocked: See forum rules)
    ServerAlias (URL address blocked: See forum rules)
    Code:
    ServerName (URL address blocked: See forum rules):443
    I am sorry for that, Here is my entire post again:

    Hi, I have an issue with Apache Virtual hosts. I installed a web server and mail server. Apache, PHP, MySQL and Postfix Dovecot ClamAV Amadis Spamassasin a RoundCube for Webmail on a Centos 6 box.

    Now, my issue is that I have my DNS like this:

    @ x.x.x.x A record
    www domain dot com CNAME
    webmail domain dot com CNAME



    Now, I can access my email via web using roundcube like this: (www dot domain dot com /webmail)

    However, when I try to access (webmail dot domain dot com) it redirects me to the default page when an index is not found.

    My Virtual host configuration is like this:

    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName (www dot domain dot com)
    ServerAlias (www dot domain dot com)
    DocumentRoot /srv/www/domain dot com/public_html/
    ErrorLog /srv/www/domain dot com/logs/error.log
    CustomLog /srv/www/domain dot com/logs/access.log combined
    </VirtualHost>

    <VirtualHost *:80>
    DocumentRoot /usr/share/roundcubemail
    ServerName webmail dot domain dot com
    </VirtualHost>

    I believe there is something with my vhost configuartion above, however, cant figure it out, since I have read a lot and all the vhost files seems to be exactly like mine. So, I can't get webmail dot domain dot com to go to my roundcube webmail and I ahve been fighting with this all day long.

    Can someone help me with this, if you need further information, please let me know. Also, even if I use http, it changes it to https... I generated self signed certificates for my email access. For apache SSL conf I have these lines:

    <VirtualHost _default_:443>

    # General setup for the virtual host, inherited from global configuration
    DocumentRoot "/var/www/html"
    ServerName www dot domain dot com:443

    # Use separate log files for the SSL virtual host; note that LogLevel
    # is not inherited from httpd conf.
    ErrorLog logs/ssl_error_log
    TransferLog logs/ssl_access_log
    LogLevel warn


    Of course there is more, but I believe that info may be enough. Please, can someone help me with this?

    Sorry for the domain dot com but due to forum rules, since I am a new member I cant use URLs, so hope you understand. Regards.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    38
    Rep Power
    3
    I was checking SSL logs and found this:}

    [Tue Aug 14 15:17:22 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
    [Tue Aug 14 15:17:23 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
    [Tue Aug 14 15:17:45 2012] [error] [client x.x.x.x] Directory index forbidden by Options directive: /var/www/html/
    [Tue Aug 14 15:17:47 2012] [error] [client x.x.x.x] Directory index forbidden by Options directive: /var/www/html/
    [Tue Aug 14 15:17:48 2012] [error] [client x.x.x.x] Directory index forbidden by Options directive: /var/www/html/
    [Tue Aug 14 15:17:49 2012] [error] [client x.x.x.x] Directory index forbidden by Options directive: /var/www/html/
    [Tue Aug 14 15:17:49 2012] [error] [client x.x.x.x] Directory index forbidden by Options directive: /var/www/html/
    [Tue Aug 14 15:17:50 2012] [error] [client x.x.x.x] Directory index forbidden by Options directive: /var/www/html/

    Not sure if it is related, but it must be, cause that is the only error I can find when trying to access webmail dot domain dot com
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    38
    Rep Power
    3
    Well I didnt receive any reply. but after reading and reading keep trying I was able to resolve this issue. This was caused by this:

    When I tried to access webmail.domain.com it changed to https, that is because roundcube configuration was configured to force ssl, so basically instead of using virtual host *:80 for webmail.domain.com it was using the virtual host listed at ssl.conf which had _default_:443 and it had documentroot set to the folder that was appearing when I tried to access webmai.domain.com instead of the roundcube web interface. SO I just changed the documentroot in that _default_:443 virtual host container to point to roundcube. Next time I need another SSL virtual host will modify that, but for the moment it is working now. HOpe this helps somebody else.

IMN logo majestic logo threadwatch logo seochat tools logo