[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: how to setup virtual hosts in apache web server



Vijay_N@xxxxxxxxxxxxxxxxxx forced the electrons to say:
> binand,
> 
> In IIS, we can have multiple sites with one ip and one interface. Can we have
> something like that here.

OK, that is what the last part of my posting refers to - I am quoting it here.

>> If you want multiple names on the same interface without even aliasing,
>> then it is going to be difficult. You probably will have to tweak with
>> individual service configuration (httpd, sendmail and such). If you want your
>> sendmail to accept mails for both firstdomain.com and seconddomain.com, add
>> these two domains in /etc/sendmail.cw and /etc/mailusertable (read the
>> documentation of sendmail). For httpd, the file to edit is
>> /etc/httpd/conf/httpd.conf. Note that these names should be resolvable - you
>> must be running DNS and in the case of sendmail, the two domains must have MX
>> records also.

Now, for one web server - apache - to server more than one domain,
you have to enable virtual hosts in apache's config file. Edit
/etc/httpd/conf/httpd.conf, and add the lines - suitably modified for
your use -

<VirtualHost www.somedomain.com>
ServerAdmin somedomain-admin@localhost
DocumentRoot /home/somedomain/public_html
ServerName www.somedomain.com
ErrorLog logs/errors_somedomain.log
TransferLog logs/access_somedomain.log
</VirtualHost>

For every virtual domain that you need to have. Note that these virtual
domains (here, www.somedomain.com) should have valid DNS records - it is
better if your run named on the server as well, with the configuration
you like.

What I wanted to say in my previous mail was, having only one interface
and one IP address for that, it is your job to configure individual
programs to reply to different names. There is no system wide kernel
level configuration for this. I have outlined how to configure your web
server to do this. In a similar way, you will also have to configure
your SMTP server, your DNS server and all other servers to achieve the
desired effect.

Hope I am clear,

Binand

PS: Don't forget to killall -HUP httpd for these changes to take effect!
---
Send e-mail to 'ilugc-request@xxxxxxxxxxxxxxxxxx' with 'unsubscribe' 
in either the subject or the body to unsubscribe from this list.