
저는 Apache 2.2 로컬 서버에서 웹사이트를 개발 중입니다. 사이트는 아직 개발 단계입니다. 나는 "localhost/xyz.php" 대신 "mysite.local" 또는 다른 이름으로 액세스할 수 있도록 내 웹사이트에 대한 사용자 정의 도메인 이름을 얻고 싶었습니다. Google에 대해 충분히 조사한 후 httpd.conf 파일에 다음 줄을 추가했습니다.
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot “C:/Apache/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName the-mini-project.com
ServerAlias the-mini-project.com
DocumentRoot “C:/Apache/htdocs”
</VirtualHost>
127.0.0.1 the-mini-project.com
또한 호스트 파일에 해당 줄을 추가했습니다 . 이 줄의 구문이나 다른 것에 문제가 있습니까? 이 줄을 추가하면 서버 실행이 중지되기 때문입니다. 제거하니 정상으로 돌아왔습니다. 도와주세요. 다른 제안이 있나요? 감사해요.
로그/error.txt
[Fri Aug 30 19:56:12 2013] [notice] Child 6676: Child process is exiting
[Fri Aug 30 19:56:12 2013] [notice] Parent: Child process exited successfully.
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.100 for ServerName
[Fri Aug 30 19:56:20 2013] [notice] Apache/2.2.25 (Win32) PHP/5.3.27 configured -- resuming normal operations
[Fri Aug 30 19:56:20 2013] [notice] Server built: Jul 10 2013 01:52:12
[Fri Aug 30 19:56:20 2013] [notice] Parent: Created child process 3152
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.100 for ServerName
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.100 for ServerName
답변1
이 구성은 의미가 없습니다. 로그는 무엇이 문제인지 말해 줄 수도 있고 안 알려줄 수도 있지만, 이것이 바로 여러분이 정말로 원하는 것이라고 생각합니다.
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:/Apache/htdocs"
ServerName localhost
ServerAlias the-mini-project.com
</VirtualHost>
답변2
단지 사소한 실수일 뿐입니다. 포트 번호가 누락되었습니다. 스스로 알아 냈습니다. 향후 참조를 위해 올바른 방법은 다음과 같습니다.
NameVirtualHost 127.0.0.1:80
"<"VirtualHost 127.0.0.1:80">"
DocumentRoot “C:/Apache/htdocs"
ServerName localhost
"<"/VirtualHost">"
"<"VirtualHost 127.0.0.1:80">"
ServerName yoursite.anything
ServerAlias yoursite.anything
DocumentRoot “C:/Apache/htdocs”
"<" /VirtualHost">"
80이 기본 포트 번호입니다.