본문 바로가기

코딩

우분투 가상호스트 설정하는 방법 (아파치 버츄얼호스트)

우분투 가상호스트 설정하는 방법 (아파치 버츄얼호스트)



1. /var/www 경로에 test1 웹폴더 및 public_html 폴더를 생성


mkdir /var/www/test1/public_html


2. /etc/apache2/sites-available 경로에 설정파일 test1.conf 생성


vi /etc/apache2/sites-available/test1.conf


3. test1.conf 파일에 아래와 같이 내용을 넣어줍니다.


<VirtualHost *:80>

        ServerName www.test1.com

        ServerAdmin webmaster@test1.com

        ServerAlias test1.com

DocumentRoot /var/www/test1/public_html

<Directory /var/www>
        

Options Indexes FollowSymLinks MultiViews
        

AllowOverride All

Order allow,deny

allow from all  

</Directory>

</VirtualHost>


4. /etc/apache2/sites-enabled 로 이동한 후.


cd /etc/apache2/sites-enabled 


5. test1.conf에 관한 심볼릭 링크를 걸어줍니다.


ln -s ../sites-available/test1.conf test.conf


6. 마지막으로 아파치를 재시작해주면 끝~!


service apache2 restart