Apache2: 여러 사이트 호스팅(Ubuntu 서버)

Apache2: 여러 사이트 호스팅(Ubuntu 서버)

저는 우분투/데비안에서 system.d와 서비스를 처음 사용합니다. 동일한 웹사이트에서 여러 웹사이트를 제공하려고 합니다.아파치 2(서비스당 3개의 apache2 폴더가 있어야 한다는 것을 알았습니다). 설치된 구성 레이아웃은 다음과 같습니다.

설치 구성 레이아웃은 다음과 같습니다.

포트 8081, 8082 및 8083에서 각각 수신 대기하도록 세 개의 서버 인스턴스를 구성해야 합니다. 예를 들어 방문할 때http://host1.com:8081,http://host2.com:8082그리고http://host3.com:8083기본적으로 HTML 페이지는 var /var/mysites/host1/index.html, /var/mysites/host2/index.html 및 /var/mysites/host3/index.html에 있습니다. 또한 다음 명령을 사용하여 Apache 서버를 시작, 중지 및 다시 시작할 수 있습니다.

sudo apache2ctl-host1 start; sudo apache2ctl-host2 start; sudo apache2ctl-host1 start;
sudo apache2ctl-host1 stop; sudo apache2ctl-host2 stop; sudo apache2ctl-host1 stop;
sudo apache2ctl-host1 restart; sudo apache2ctl-host2 restart; sudo apache2ctl-host1 restart;

내 인스턴스를 테스트하려면 다음 조건을 충족해야 합니다.

명령을 실행하여 Apache2 웹 서버 설치를 확인하십시오 dpkg --get-selections | grep apache2.

서버 인스턴스는 sudo를 실행하여 시작됩니다.apachec2ctl-host1 start; sudo apachec2ctl-host2 start; sudo apachec2ctl-host3 start;

sudo 명령을 실행하여 포트를 확인합니다 lsof -i:8081 | grep apache2, sudo lsof -i:8082 | grep apache2and sudo lsof -i:8083 | grep apache2.

HTML 컨텐츠는 curl host1.com:8081curl host2.com:8082명령 을 실행하여 curl host3.com:8083얻습니다 .

이 페이지는 403 또는 404 오류 페이지일 수 없습니다. 즉, 다음 명령은 0이 아닌 코드로 종료되어야 합니다.

curl host1.com:8081 | grep 403\ Forbidden
curl host1.com:8082 | grep 403\ Forbidden
curl host1.com:8083 | grep 403\ Forbidden
curl host1.com:8081 | grep 404\ Not \ Found
curl host1.com:8082 | grep 404\ Not \ Found
curl host3.com:8083 | grep 404\ Not \ Found

또한 HTML 파일 /var/save/mysites/host1/index.html/var/save/mysites/host2/index.html렌더링 /var/save/mysites/host3/index.html된 HTML 파일은 동일해야 합니다.

내 진짜 질문은 이 예제와 같은 서비스를 어떻게 만들 수 있느냐는 것입니다.

sudo apache2ctl-host1 start

관련 정보