Apache2Triad Help, Support and Development Forum Index Apache2Triad Help, Support and Development
The apache2triad help , support and development forums
 

RESOLVED: Apache fails to restart after VirtualHosts config
Click here to go to the original topic

 
       Apache2Triad Help, Support and Development Forum Index -> Apache
View previous topic :: View next topic  
Author Message
callingrohit



Joined: 23 Aug 2006
Posts: 1

Posted: Wed Aug 23, 2006 3:26 am    Post subject: RESOLVED: Apache fails to restart after VirtualHosts config  

Hi ,

I have gone through the virtual host tutorial and many other post. I have also gone throught apache's article on vhosts but I've failed to configure it on my system.

I have the latest a2t installed on my win xp box. Its installed in the C drive and I would like to have my webroot on another drive. I know I have a option to install it on the same drive as my webroot mking things easier but i would really like to configure vhosts.

Now, I have tried a couple of things. Also, I have a dynamic dns domain name which always relaates to my ever changing WAN ip. This has been configured on my router. Anyways right now I'm just trying to get a success in local network

I tried adding the following to my httpd.conf
Code:

Listen 127.0.0.1:80
Listen 127.0.0.1:81

NameVirtualHost *

<VirtualHost localhost:81>
ServerName myweb
DocumentRoot g:/WEBROOT/myweb/html/
ErrorLog g:/WEBROOT/logs/myweb-error_log
CustomLog g:/WEBROOT/logs/myweb-access_log common
</VirtualHost>



Restarted apache-- got service failed so tried "httpd -t" at command prompt and got the following

[date and time] [warn] NameVirtualHost *:0 has no VirtualHosts
Syntax OK

So I changed the NameVHost * to NameVirtualHost localhost:81

Ran "httpd -t" at command prompt again and this time I got no warnings and said SYNTAX OK.

Tried to restart apache --nothing service failed. As soon as I remove stuff from Listen, NameVHosts and VHosts...apache starts fine.....can someone be kind enough to explain me whatz gng wrong and how can I rectify this to have a actual vhost working without any glitches.

Thanks
rohit


######################################################################################################ISSUE RESOLVED SOLUTION GIVEN BELOW ########## ###############################################
###############################################

I was finally able to solve the problem of creating virtual hosts on my Win XP Pro machine with the lastest apache2triad installed.

I'll explain you my setup too...I have signed up with dyndns as my ISP provides a dynamic WAN ip. My router has the capability to update the dyndns name with my ever changing WAN ip. So with my DYNDNS, outside people can checkout my website. One every imp thing is that you need to open port 80 on your root directed towards the internal ip of the computer/server on which you decide to host your website.

Here are the commands that you need to put in apache's httpd.conf file. This file is located under c:/apache2triad/conf/ (I have installed apache2triad in C drive)

Code:
NameVirtualHost localhost

#This one is for accessing apache2triad's control panel and other configurations. The reason I #have not entered error and custom log statements because they are already in place ---- done #by apache2triad.

<VirtualHost localhost>
   ServerName localhost
   DocumentRoot "C:/apache2triad/htdocs"
   php_value include_path "C:/apache2triad/htdocs"
</VirtualHost>

#This one is pointing to another webroot directory where i plan to host a image gallery

<VirtualHost localhost>
   ServerName mywebgallery
   DocumentRoot "g:/WEBROOT/mywebgallery"
   php_value include_path "g:/WEBROOT/mywebgallery"
   ErrorLog g:/WEBROOT/logs/mywebgallery-error_log
   CustomLog g:/WEBROOT/logs/mywebgallery-access_log common
</VirtualHost>


One last important thing to do is to find the "hosts" file on your windows machine usually located under c:/windows/system32 blah blah...not sure..i just use search of xp. Anyways once you open up the file you might see a entry for
Code:
127.0.0.1<tab space>localhost

You need to change this to
Code:
127.0.0.1<tab space>localhost mywebgallery


The reason I have made a change on the hosts file is because I'm running VirtualHosts on my system, I would like the 127.0.0.1 to relate with both the server names. This way I haven't disturbed the localhost direction which is to apache2triad's control panel and infact i have successfully added an extra host - a virtual one named mywebgallery.

So now if i entered http://localhost I would see the index directory from apache2triad's htdocs and if i did http://mywebgallery I would see my image gallery.

In my case, the apache server was not starting and giving service failed errors because i wasn't putting the "php_value include_path <webroot directory>" statement. Also, with the errorlog and custom log statements, I had to create a directory named logs under the webroot otherwise, apache was providing service failed again.

I hope my research helps because I don't think everybody gets the same kind of errors after configuring virtual hosts. Some have no errors at all unfortunately I wasn't one of them but I'm happy i was able to study apache a bit more in details. Actually had to go through the manual.

Have fun everyone...hope it works out for you...

cheers
rohit....

Admins and Mods I would really appreaciate if you could convert this POST into a sticky or as a FAQ so that it helps the whole apache2triad community.
Thanks
Back to top  
 
       Apache2Triad Help, Support and Development Forum Index -> Apache
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.13 © 2001, 2002 phpBB Group