1

i am developing a website on Apache 2.2 local server. The site is still in development stage. I wanted to get a custom domain name for my website, so that i could access it as "mysite.local" or something instead of "localhost/xyz.php". After enough research on google i added these lines to the httpd.conf file:

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>

I also added the line 127.0.0.1 the-mini-project.com to hosts file. Is there something wrong with the syntax of these lines or something else? Because the server stops running after i add these lines. It was back to normal when i removed them. Please help. Any other suggestions? Thanks.

Log/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  
jgillich
  • 445
  • 5
  • 10

2 Answers2

1

This configuration makes no sense. The logs may or may not tell you what's wrong with it, but I guess this is want you really want:

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
    DocumentRoot "C:/Apache/htdocs"
    ServerName localhost
    ServerAlias the-mini-project.com
</VirtualHost>

https://httpd.apache.org/docs/2.2/mod/core.html#virtualhost

jgillich
  • 445
  • 5
  • 10
0

Just a minor mistake. The port number was missing. Figured it out myself. For future references the correct way to do it is :

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 is the default port number.