2009년 5월 13일 수요일

아파치(Apache) 가상호스트(NameVirtualHost) 설정(httpd.conf) 예제

포트별 설정 예제, 80번과 8000번

Listen 80
Listen 8000


NameVirtualHost *:80

NameVirtualHost *:8000


<VirtualHost *:80>
    ServerAdmin
yourname@yourdommain
    DocumentRoot /usr/local/www/data
    ServerName
www.example.com
        <Directory /usr/local/www/data>
            Options Indexes FollowSymLinks MultiViews ExecCGI

            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:8000>
    ServerAdmin
yourname@yourdommain
    DocumentRoot /usr/home/user/www
    ServerName
www.example.com
        <Directory /usr/home/user/www>
            Options Indexes FollowSymLinks MultiViews ExecCGI

            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
#    ErrorLog /var/log/error_log
#    CustomLog /var/log/access_log common
</VirtualHost>


 도메인별 설정 예제, www.example.com, sub.example.com

NameVirtualHost *:80

 

<VirtualHost *:80>
    ServerAdmin
yourname@yourdommain
    DocumentRoot /usr/local/www/data
    ServerName
www.example.com
        <Directory /usr/local/www/data>
            Options Indexes FollowSymLinks MultiViews ExecCGI

            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin
yourname@yourdommain
    DocumentRoot /usr/local/www/data
    ServerName sub
.example.com
        <Directory /usr/local/www/data>
            Options Indexes FollowSymLinks MultiViews ExecCGI

            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

댓글 없음:

댓글 쓰기