가상 호스트를 만들어서 IP마다 웹페이지를 만든다.
* ip를 가상으로 할당한다.
cd
/etc/sysconfig/network-scripts
cp
ifcfg-ens32 ifcfg-ens32:0
vi
ifcfg-ens32:0
# device와 IPADDR를 수정한다.
systemctl
restart network
환경설정이 끝나면 항상 웹관리자로 로그인해서 설정한다.
# 아파치 서버를 정지시키고 환경 파일을 설정한다.
/app/apache/bin/apachectl stop
vi
/app/apache/conf/httpd.conf
# 주석처리 해제
# 아래 vhosts.conf에서 설정한다는것이다.
Include conf/extra/httpd-vhosts.conf
# 입력
DocumentRoot
/home/web/httpd/152
ServerName
192.168.10.152
DocumentRoot
/home/web/httpd/153
ServerName
192.168.10.153
# 수정하여 httpd 아래 모든 폴더에 접속할 수 있도록 변경해준다.
# 가상 호스트 설정
vi /app/apache/conf/extra/httpd-vhosts.conf
NameVirtualHost
*:80
// 이거 수정하면 안됨
# 아래 가상환경을 설정해준다.
ServerAdmin
webmaster@dummy-host.example.com
DocumentRoot
"/home/web/httpd/153"
ServerName 192.168.10.153
ServerAlias www.dummy-host.example.com
ErrorLog
"logs/dummy-host.example.com-error_log"
CustomLog
"logs/dummy-host.example.com-access_log" common
ServerAdmin
webmaster@dummy-host.example.com
DocumentRoot
"/home/web/httpd/152"
ServerName 192.168.10.152
ServerAlias www.dummy-host.example.com
ErrorLog
"logs/dummy-host.example.com-error_log"
CustomLog
"logs/dummy-host.example.com-access_log" common
# 해당 디렉토리를 만들어주고
cd
/home/web/httpd
cp
-R html 153
cp
-R html 152
# 내용을 수정하여 구분한다.
vi
/home/web/httpd/153/index.html
vi
/home/web/httpd/152/index.html
# 아파치서버를 재시작해본다.
/app/apache/bin/apachectl restart
확인한다.
# extra디렉토리의 httpd-vhosts.conf 쪽에서 귀찮타면 httpd.conf 에서 설정하면 된다.
댓글 없음:
댓글 쓰기