티스토리 뷰

Deploy

아파치 virtual host 세팅

Aairon 2019. 8. 20. 10:51
반응형

ec2에서 아파치를 설치 후 virtual hosting을 세팅하는 방법.


cd /etc/apache2/sites-available


vi 해당폴더안에 있는 conf파일 이름

#버츄얼 호스팅을 통해 proxy설정을 해야 할 때

#노드 등 띄워야 할 때

<VirtualHost *:80> ServerName 도메인 이름 DocumentRoot /var/www/html/ -루트 폴더 설정 <Directory /> Options -Indexes +FollowSymLinks AllowOverride None Require all granted </Directory> ProxyRequests Off ProxyPreserveHost On ProxyVia Full <Proxy *> Require all granted </Proxy> <Location /> ProxyPass 서버네임으로 접속시 접속시킬 서버 도메인 ProxyPassReverse 서버네임으로 접속시 접속시킬 서버 도메인 </Location> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>


#버츄얼 호스팅만 필요할 때 / 스태틱 파일만 줄때 <VirtualHost *:80>

ServerName 도메인 이름

DocumentRoot /var/www/html/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <Directory /var/www/html/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>


위의 사항 변경 후 아파치 재시작

명령어 종류systemctl ★★service/etc/init.d/ ★apachectlhttpd[1]
우분투 (서비스명: apache2)
아파치 상태 확인systemctl status apache2service apache2 status/etc/init.d/apache2 status··
아파치 시작systemctl start apache2service apache2 start/etc/init.d/apache2 start··
아파치 정지systemctl stop apache2service apache2 stop/etc/init.d/apache2 stop··
아파치 재시작systemctl restart apache2service apache2 restart/etc/init.d/apache2 restart··
아파치 리로드systemctl reload apache2service apache2 reload/etc/init.d/apache2 reload··


반응형
댓글