간단하게 요약하자면
1. 웹서버 소스
2. httpd.conf용 폴더생성 (site-available, sites-enable 폴더 사용)
3. virtual host용 conf파일 작성
4. httpd 재시작
1. 웹서버 소스
/www/test/index.html
/www
ㄴ test
ㄴ index.html
2. httpd.conf 용 폴더생성 (site-available, sites-enable)
$ cd /etc/httpd/conf
$ sudo mkdir sites-available
$ sudo mkdir sites-enable
sites-available에 이런저런 conf파일을 저장하는 용도
sites-available의 conf파일을 sites-enable에 넣어주면 사용됨.
httpd.conf에 해당 폴더 연결
$ sudo vi /etc/httpd/conf/httpd.conf
맨 마지막줄에 추가
Include /etc/httpd/conf/sites-enable/*.conf
3. Virtual host conf파일 작성
위의 test/index.html 경로를 알고 있어야 함.
$ cd /etc/httpd/conf/sites-available
$ sudo vi httpd-vhosts.conf
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
DocumentRoot /www/test
<Directory "/" >
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /www/test/error.log
CustomLog /www/test/access.log combined
</VirtualHost>
sites-available 에 httpd-vhosts.conf 라는 파일이 생성됨
이제 sites-enable에 심볼릭 링크 생성해 주면 됨.
$ cd /etc/httpd/conf/sites-enable
or
$ cd ../sites-enable
$ sudo ln -s ../sites-available/httpd-vhosts.conf
4. httpd 재시작
$ sudo systemctl restart httpd
'Develop > Linux' 카테고리의 다른 글
06. FTP 설치 및 설정 (vsftpd) (0) | 2021.08.01 |
---|---|
03. CentOS 웹서버 설치 (php, httpd, mariaDB) (0) | 2021.07.29 |
02. CentOS 포트열기 (0) | 2021.07.29 |
리눅스 사용자 계정 추가 및 sudo 권한추가 (0) | 2019.09.03 |