아무거나

apache2 한 서버에 다중 VirtualHost 설정 본문

Infra/Apache

apache2 한 서버에 다중 VirtualHost 설정

전봉근 2019. 4. 22. 15:00
반응형

경로 : /etc/apache2/sites-available/000-default.conf

 

ex ) 내용 추가

 

<VirtualHost *:80>
        <Directory "{소스경로}">
            AllowOverride All
        </Directory>

        ServerName localhost
        ServerAlias local.test.kr
        ServerAdmin webmaster@localhost
        DocumentRoot {소스경로}
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        #RewriteEngine On
        #RewriteCond %{HTTP_HOST} ^(www\.zooma\.kr$)
        #RewriteRule (.*) http://test.kr$1 [R=301,L]
</VirtualHost>


<VirtualHost *:80>
        <Directory "{소스경로}​">
            AllowOverride All
        </Directory>
        ServerName localhost
        ServerAlias local.test2.kr
        ServerAdmin webmaster@localhost
        DocumentRoot {소스경로}​
        ErrorLog ${APACHE_LOG_DIR}/error_html.log
        CustomLog ${APACHE_LOG_DIR}/access_html.log combined
</VirtualHost>


<VirtualHost *:80>
        <Directory "{소스경로}​">
            AllowOverride All
        </Directory>
        ServerName localhost
        ServerAlias local.test3.com
        ServerAdmin webmaster@localhost
        DocumentRoot {소스경로}​
        ErrorLog ${APACHE_LOG_DIR}/error_html.log
        CustomLog ${APACHE_LOG_DIR}/access_html.log combined
</VirtualHost>
반응형
Comments