Question on Apache behaviour

Discussion in 'General' started by ChristianFe, Jul 4, 2009.

  1. ChristianFe

    ChristianFe New Member

    Hi guys,

    sorry to bother you with questions again, but for once I've got the intention of getting my server to work exactly as I want it, not just "working but not nice" and on the way I only want to do thinks that I feel I understand.
    As such a few questions:

    (I've installed ISPConfig 3, following the Perfect Server Howto, onto a fresh Debian Lenny.)

    I have currently got 2 domains set up on the server. I've set www.* aliases and these two domains work flawlessly.

    I've also setup a webmail.domain1.tld site and symlinked the squirrelmail install into this. I created a webmail.domain2.tld alias for this and I intend to somehow automate this for future sites added, but that's not a priority at the moment.

    www.domain1.tld --> works
    domain1.tld --> works
    www.domain2.tld --> works
    domain2.tld --> works
    webmail.domain1.tld --> squirrelmail
    webmail.domain2.tld --> squirrelmail

    The issue with the apache setup I'm having now is that I don't want the IP address or any unconfigured domains that point to the server IP (e.g. mail.domain1.tld, mail.domain2.tld) to point to the "It works!" bit in /var/www.

    I'd like a "default" vhost that every unconfigured domain is routed to.
    Can I edit /etc/apache2/sites-available/default for this purpose to point to e.g. /var/www/default? (I'd then put a single index.html in there saying "you've reached an unconfigured domain")

    Is it advisable to manually create a seperate vhost for accessing things such as the amavis-stats etc ?

    What is the general advice on how to handle "default pages" and the webmail thing ?

    I hope what I wrote made some sense and you can give me some advice.

    Thanks

    Chris
     
  2. voidzero

    voidzero New Member

    Well, the default currently is set to /var/www - all you'd do is change it to /var/www/default. I'm using .htaccess files to customize the behaviour - both simple, and it has tons of options.

    About webmail; I wouldn't symlink the webmail bit - see my post here for a .htaccess solution.

    Amavis stats, dunno, never used them :D
     
  3. ChristianFe

    ChristianFe New Member

    Thanks for your answer. Your solution is certainly an interesting alternative to handle the webmail issue, especially as it means that one doesn't have to set up things manually if new domains are added or something like that.

    still not sure about the "default" vhost though. Looks to me like it is potentially unsafe to have it point to "/var/www" or is that just me being paranoid and just plain wrong about this ?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    This is not unsafe as all relevant directories used by ISPConfig are secured and can not be accessed trough the default vhost.
     
  5. ChristianFe

    ChristianFe New Member

    alright so there's no problem.

    I'm running into something else that I don't get though:

    I've got one IP pointing to the server.
    The vhosts are all set to <VirtualHost *:80>

    There is that warning that my_server_ip:80 and my_server_ip:443 have no VirtualHosts, no worries there. That shouldn't be a problem.

    I've get a line in /etc/apache2/ports.conf specifying <NameVirtualHost *:80>.
    Now if I set any of the virutal host to my_server_ip:80 instead of *:80 every domain and the server IP address just point to that vhost ?

    Is it not possible to mix IP and * VirtualHosts ?

    Should the "default" one read *:80 or _default_:80 ?

    I've had a read through http://httpd.apache.org/docs/2.0/vhosts/examples.html but that didn't help too much.

    Thanks for all the help

    Chris
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The configuration ISPConfig uses is fine, you dont have to change anything. * is a wildcard and not the same as _default_. And yes, you can mix IP and * based hosts on the same server but not on the same IP, so you need to have more then one IP if you want to mix them.
     

Share This Page