Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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  
share|improve this question
    
it would be helpful if you post what's written in the logs –  mauro.stettler Aug 30 '13 at 18:16
    
can u please direct me to find these logs? –  Shashank Raghunath Aug 30 '13 at 18:32
    
From your paths I'm guessing you use Windows, so I don't know where they are... but I'm sure somebody else here knows –  mauro.stettler Aug 30 '13 at 18:32
    
@mauro.stettler i found these on Apache's error log –  Shashank Raghunath Aug 30 '13 at 18:52
    
What do you mean by "the server stops running"? –  sciurus Aug 30 '13 at 19:36

2 Answers 2

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

share|improve this answer
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.