1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Apache Virtual Host for subdomain

Discussion in 'Apache' started by jaimitoc30, Aug 10, 2012.

  1. #1
    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.com CNAME
    webmail domain.com CNAME

    Now, I can access my email via web using roundcube like this: http://www.domain.com/webmail

    However, when I try to access http://webmail.domain.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.domain.com
    ServerAlias www.domain.com
    DocumentRoot /srv/www/domain.com/public_html/
    ErrorLog /srv/www/domain.com/logs/error.log
    CustomLog /srv/www/domain.com/logs/access.log combined
    </VirtualHost>

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

    I believe there is something with my vhost configuartion above, however, can 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.domain.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.domain.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?
     
    jaimitoc30, Aug 10, 2012 IP
  2. jaimitoc30

    jaimitoc30 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nobody? that can give me a hint at least?
     
    jaimitoc30, Aug 13, 2012 IP
  3. whrsstech

    whrsstech Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hello,

    Try changing the DNS record for webmail. Delete the CNAME and configure an A record(To the same IP address of your domain). That should work.
     
    whrsstech, Aug 15, 2012 IP
  4. bestemployer

    bestemployer Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    In addition to whrsstech's comment, I'd like to add that having www subdomain as CNAME is not the best idea. Set it up as an A record as well and let Apache handle things here. You can set up redirections to/from www. addresses via httpd.conf if you want.
     
    bestemployer, Aug 17, 2012 IP