Ubuntu 11.04 installed with apache2 and all the relevant packages installed. I have tried most of the blogs and made google and other forums my best friends, yet I'm unable to solve this issue.
I Need to set up a named virtual host on my local system for development.
I created the directory "vivek" in /var/www and copied the default index.html and edited some elements.
I added the file vivek.com in /etc/apache2/sites-available as follows:
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.vivek.com
DocumentRoot /var/www/vivek
# Other directives here
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/vivek/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
I.e I've added these following lines
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.vivek.com
DocumentRoot /var/www/vivek
# Other directives here
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/vivek/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
To the default file which was already present in "sites-available" folder(took the back up of default file before editing it)
Added this in the hosts file present in /etc/hosts
127.0.0.1 localhost
127.0.1.1 vivek-PC
127.0.0.1 www.vivek.com
Performed the following operations with no errors:
root@vivek-PC:~# a2ensite vivek.com
Enabling site vivek.com.
Run '/etc/init.d/apache2 reload' to activate new configuration!
root@vivek-PC:~# /etc/init.d/apache2 reload
* Reloading web server config apache2
When I entered www.vivek.com,it gave me the default index.html in /var/www but not one present in the folder /var/www/vivek which is edited.
Later, I edited the index.html from /var/www but I was still getting the same index.html (default-before editing). All the index.htmls have been edited but Apache seems to have some hidden one which keeps coming up when I request for www.vivek.com
And the ironic thing is after I restart -- Apache came up fine but my site -- www.vivek.com failed to show up (even with the index.html which is hidden god knows where!!).. Now my browser is showing "Unable to connect "
Please help.I've been trying to set this up since a week with no successful result.