MacBook 가상 호스트 구축
1907 단어 서버
sudo vim /etc/apache2/httpd.conf
Include / private / etc / apache 2 / extra / httpd - vhosts. conf 이 줄 앞의 주석 기 호 를 # 제거 합 니 다.3. httpd - vhosts. conf 파일 을 편집 하고 명령 을 입력 합 니 다.
vim /etc/apache2/extra/httpd-vhosts.conf
i 를 누 르 면 편집 모드 에 들 어 갑 니 다. httpd - vhosts. conf 에서 기본 두 개의 VirtualHost 를 삭제 하거나 추가 합 니 다.
ServerAdmin webmaster@localhost
DocumentRoot "/Users/lax/sites"
ServerName localhost
ErrorLog "/private/var/log/apache2/beta.test.com-error_log"
CustomLog "/private/var/log/apache2/beta.test.com-access_log" common
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
ServerAdmin [email protected]
DocumentRoot "/Users/lax/sites/test"
ServerName beta.test.com
ErrorLog "/private/var/log/apache2/beta.test.com-error_log"
CustomLog "/private/var/log/apache2/beta.test.com-access_log" common
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
esc 를 누 르 면 입력: wq Enter 저장 종료
4. hosts 파일 을 수정 하여 도 메 인 이름 beta. test. com 을 로 컬 IP 에 대응 하고 명령 을 입력 하 십시오.
sudo vim /etc/hosts
줄 추가:
127.0.0.1 beta.test.com
5. 서버 재 부팅
sudo apachectl restart
6. 브 라 우 저 에서 localhost 와 beta. test. com 을 방문 하여 보기