virtual host running on apache2

history:

I had drupal configured and running on my machine, this were good. but understanding drupal and going ahead with it became a trouble. so I wanted to go with plain php scritping, so next step was to create a new server for the new website.

problem:

I configured the apache2 for the additional virtual host using debinalink. but my new url is not working

when restart the apache2 or reloading got problems about the warnign on “NameVirtualHost *:80”.

remn@ubuntu:/etc/apache2$ sudo /etc/init.d/apache2 reload
* Reloading web server config apache2                                                                                                                                                        [Sat Jul 27 00:27:37 2013] [warn] NameVirtualHost *:80 has no VirtualHosts

 solution : go remove/ comment “#NameVirtualHost *:80” from /etc/apache2/ports.conf

 Hint: grep for “NameVirtualHost *” and confirm that all the enteries in the apache2 folder are similar.

and the virtual host configuration works fine as below but the url is not working.

premn@ubuntu:/etc/apache2$ apache2ctl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
default server preetam-box (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost preetam-box (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost drupal722 (/etc/apache2/sites-enabled/drupal722:1)
port 80 namevhost preetamsite (/etc/apache2/sites-enabled/preetamsite:1)
Syntax OK
premn@ubuntu:/etc/apache2$ source /etc/apache2/envvars ; /usr/sbin/apache2 -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
default server preetam-box (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost preetam-box (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost drupal722 (/etc/apache2/sites-enabled/drupal722:1)
port 80 namevhost preetamsite (/etc/apache2/sites-enabled/preetamsite:1)
Syntax OK

these are ok.

solution:
problem is that the dns is not getting resolved and to get this working we need to edit:

/etc/hosts with our new website

127.0.0.1   localhost
127.0.0.1   drupal722
127.0.0.1   preetamsite    <== new entry here
127.0.1.1   ubuntu

this lets the dns to route our url to apache2

conclusion:
have patience with google and ask right questions . i wasted my 4 hrs of time and found this. was it worth it? it was 🙂

Advertisements

About preetammn

engineer trying to figure out the world, people and machines.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s