이 질문은 여러 번 받고 있다고 생각합니다만, 문제가 있는 것은 아닙니다.XAMPP를 사용하여 Zend 프레임워크를 설정합니다.
XAMPP는 포트 8081에서 실행되고 있으며 80이 Windows 프로세스에 의해 점유되고 있습니다.다음 코드로 설정한 가상 호스트를 사용해야 합니다.C:/xampp/apache/config/extra/httpd-vhosts.config
(또는C:/xampp/apache/conf/extra/httpd-vhosts.conf
를 참조해 주세요).
<VirtualHost *:80> ServerName comm-app.local DocumentRoot "C:/xampp/htdocs/CommunicationApp/public" SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public"
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory> </VirtualHost>
호스트 파일을 업데이트 합니다.127.0.0.1 comm-app.local
apache를 재기동하려고 해도 에러가 표시됩니다.
15:03:01
[Apache]
Error: Apache shutdown unexpectedly. 15:03:01
[Apache]
This may be due to a blocked port, missing dependencies,
15:03:01
[Apache]
improper privileges, a crash, or a shutdown by another method. 15:03:01
[Apache]
Press the Logs button to view error logs and check 15:03:01
[Apache]
the Windows Event Viewer for more clues 15:03:01
[Apache]
If you need more help, copy and post this 15:03:01
[Apache]
entire log window on the forums
질문에 대한 답변
순서 1) C:WINDOWSsystem32driversetc”hosts” 파일을 엽니다.
127.0.0.1
localhost 127.0.0.1
test.com 127.0.0.1
example.com
스텝 2) xamppapacheconfextrahttpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs/test/
ServerName www.test.com </VirtualHost> <VirtualHost *:80>
DocumentRoot C:/xampp/htdocs/example/
ServerName www.example.com </VirtualHost>
스텝 3) C:xamppapacheconfhttpd.conf.마지막에 있는 [Supplemental configuration]섹션까지 스크롤하여 다음 섹션(500줄 전후)을 찾습니다.다음 섹션은 두 번째 줄 선두에서#을 삭제합니다.이 섹션은 다음과 같습니다.
#Virtual hosts Include conf/extra/httpd-vhosts.conf
순서 4) XAMPP를 재기동하여 브라우저에서 실행합니다.
www.example.com or www.test.com
에러가 2개 표시됩니다.
<VirtualHost *:80> -> Fix to :8081, your POrt the server runs on
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public" -> This is probably why it crashes, missing >
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
-> MIssing close container: </VirtualHost>
고정 버전:
<VirtualHost *:8081>
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory> </VirtualHost>
한 가지 짚고 넘어가야 할 점:
언제든지 다음 명령을 실행할 수 있습니다.
service apache2 configtest
이것에 의해, 설정이 잘못되어 문제가 발생하고 있는 장소를 알 수 있습니다.
또한 라이브 시스템에서 사용할 수 없는 상태를 방지하는 데 도움이 됩니다.
service apache2 restart
가 셧다운되고 나서 기동할 수 없게 됩니다.이 설정 테스트에서는, 사전에 「어쩌다, 잘못했다, 이것을 먼저 수정해야 한다」라고 하는 것을 알 수 있습니다만, Apache 자체는 아직 낡은 설정으로 실행되고 있습니다.🙂
이 코드를 C:xamppapacheconfextrahttpd-vhosts.conf에 추가합니다.
<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName qa-staging.com ServerAlias www.qa-staging.com <Directory "c:/xampp/htdocs"> Order allow,deny Allow from all </Directory> </VirtualHost>
이제 아래 파일에 가상 호스트 이름을 추가합니다.
C:WindowsSystem32driversetchosts
127.0.0.1 qa-staging.com
이 코드를 호스트 파일에 저장할 수 없는 경우 Notpad 오른쪽 버튼을 클릭하여 Run as administrator를 선택하면 사용자 지정 코드를 저장할 수 있습니다. XAMP를 다시 시작합니다.
다음 코드는 C:xamppapacheconfextrahttpd-vhosts.conf 파일의 끝에 씁니다.
DocumentRoot "D:/xampp/htdocs/foldername" ServerName www.siteurl.com ServerAlias www.siteurl.com ErrorLog "logs/dummy-host.example.com-error.log" CustomLog "logs/dummy-host.example.com-access.log" common
가상 호스트 태그 사이에 있습니다.
메모장을 관리자로 사용하여 System32/Drivers/etc/hosts 파일을 편집합니다.
파일 맨 아래 추가
127.0.0.1
www.siteurl.com
<VirtualHost *:80>
DocumentRoot "D:/projects/yourdirectry name"
ServerName local.yourdomain.com
<Directory "D:/projects/yourdirectry name">
Require all granted
</Directory> </VirtualHost>
Apache 구성 파일을 저장합니다.
상세한 것에 대하여는, 여기를 참조해 주세요.