리눅스 아파치 VirtualHost 설정 방법
/etc/httpd/conf/httpd.conf 파일에
Include conf/example.conf 을 추가해서 아래의 파일을 /etc/httpd/conf/example.conf 파일로 저장을 하거나
/etc/httpd/conf.d/example.conf 파일로 저장을 하면 된다.
가상호스트를 여러개를 만들어야 하는 경우라면 두번째 방법이 편하다.
그리고 80 포트 외에 다른 포트를 사용하고 싶다면
Listen 8080
NameVirtualHost *:80
NameVirtualHost *:8080
<VirtualHost *:80 *:8080>
이렇게 적어주면 된다.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /home/example/www
SetEnvIfNoCase Request_URI "\.(png|gif|jpg|js|css|ico)$" NO_LOG
SetEnvIf Remote_Addr "^::1$" NO_LOG
ErrorLog logs/www.example.com-error_log
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vcommon
CustomLog logs/www.example.com-access_log vcommon env=!NO_LOG
<IfModule mod_ruid2.c>
RDocumentChRoot / /home/example/www
RMode config
RUidGid example example
</IfModule>
</VirtualHost>
mod_ruid2 부분은 사용자계정의 권한을 갖게 해주는 모듈이다.
설치 방법은 https://ivps.tistory.com/72 여기를 참고하자.
'LINUX' 카테고리의 다른 글
리눅스 아파치 서버가 살아있는지 체크하는 쉘스크립트 (0) | 2016.05.26 |
---|---|
아파치 IP 로 접속시 차단 방법 (2) | 2016.05.26 |
CentOS 7.x 아파치 mod_ruid2 설치 및 설정방법 (0) | 2016.05.26 |
아파치 .htaccess Rewrite URL 리디렉트 처리 (0) | 2016.05.26 |
리눅스 네트워크 트래픽 모니터링 vnstat 설치 (1) | 2016.05.25 |