티스토리 뷰

OpenSUSE 11 Apache2 Virtual Hostings


Virtual Hostings

 

Configure Virtual Hostings to use maltiple domain names.

The example below is set on an environment which the domain name is [srv.world], virtual domain name is [virtual.host (root directory[/home/suse/public_html])]. It's necessarry to set Userdir settings for this example, too.



1. Configure Virtual Hostings.


www:~ # vi /etc/apache2/listen.conf

# line 41: uncomment

NameVirtualHost *:80

www:~ # vi /etc/apache2/vhosts.d/defalt.site.conf

# create new for default site

 <VirtualHost *:80>

    DocumentRoot /srv/www/htdocs

    ServerName www.srv.world

</VirtualHost>


www:~ # vi /etc/apache2/vhosts.d/virtual.host.conf

# create new for virtual.host

 <VirtualHost *:80>

    ServerName www.virtual.host

    ServerAdmin webmaster@virtual.host

    DocumentRoot /home/suse/public_html

    ErrorLog /var/log/apache2/virtual.host.error.log

    CustomLog /var/log/apache2/virtual.host.access.log combined

    LogLevel warn

</VirtualHost>


www:~ # /etc/init.d/apache2 restart 




2. Create a test page and access to it from a client computer with a web browser. It's OK if following page is shown.


suse@www:~> vi public_html/virtual.php

<html>

<body>

<div style="width: 100%; font-size: 40px; font-weight: bold; text-align:center;">

Virtual Host Test Page<br />

</div>

</body>

</html>



3. Access to www.virtual.host



저작자 표시 비영리 변경 금지
신고
댓글