dnf 로 아파치 설치후, vhost (가상호스트) 설정하기 > 리눅스

본문 바로가기

회원로그인

회원가입

리눅스

레드햇 dnf 로 아파치 설치후, vhost (가상호스트) 설정하기

페이지 정보

profile_image
작성자 최고관리자
댓글 0건 조회 122회 작성일 20-08-27 14:17

본문

cent os 8

아파치 설치 후, vhost 설정

    >dnf install httpd


    1. /etc/httpd/cond.d/ 폴더에 .conf 파일 추가

/etc/httpd/conf.d/test.co.kr.conf 파일에 아래 내용으로 저장

================================================================================
        <VirtualHost *:80>
            ServerAdmin webmaster@dummy-host.example.com
            DocumentRoot /home/test
            ServerName aaa.com
            ServerAlias www.aaa.com
            ErrorLog logs/dummy-host.example.com-error_log
            CustomLog logs/dummy-host.example.com-access_log common
           
# 개별폴더일때는 따로 권한설정을 주어야 한다.
            <Directory "/디렉토리">
                AllowOverride None
                Require all granted
            </Directory>
        </VirtualHost>

================================================================================



    2. vhost.conf 파일추가
    /etc/httpd/conf/httpd.conf : 하단에 아래를 추가
   
        include /etc/httpd/conf/vhost.conf

        2.4.x 버전 이상일때
        <Directory "/home">
            AllowOverride None
            Require all granted
        </Directory>
       
        Apache 2.2.X 버전 이하일 경우
        <Directory "/디렉토리 경로">
           AllowOverride None
           Order allow,deny
           Allow from all
        </Directory>
       
       
    NameVirtualHost *:80 [※ Apache 2.2.X 이하는 무조건 추가]
        이름 기반의 가상 호스트(도메인별) 사용하겠다는 뜻이나
        [Apache 2.4.X] 이상부터는 해당 값을 넣을 필요 없이 디폴트로 적용됩니다.
   
        넣어도 상관은 없으나 [Apache 2.4.X] 일부 구버전에서는 아래와 같이 메시지가 발생할 수 있습니다.
        AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf/httpd.conf:356
        문제는 없습니다.
        하지만 쓸데없는 로그는 되도록 안 나오게 하는 게 좋으므로 결론은 안 넣어도 됩니다.
       

    /etc/httpd/conf/vhost.conf : 파일추가

        <VirtualHost *:80>
            ServerAdmin webmaster@dummy-host.example.com
            DocumentRoot /home/test
            ServerName aaa.com
            ServerAlias www.aaa.com
            ErrorLog logs/dummy-host.example.com-error_log
            CustomLog logs/dummy-host.example.com-access_log common
           
# 개별폴더일때는 따로 권한설정을 주어야 한다.
            <Directory "/디렉토리">
                AllowOverride None
                Require all granted
            </Directory>
        </VirtualHost>
 

댓글목록

등록된 댓글이 없습니다.