Skip to main content

Thread: How to create a virtual host??


ubuntu 11.04 installed apache2 , relevant packages installed

tried of blogs , made google , other forums best friends,yet unable solve issue.

need setup named virtual host on local system development.

created directory "vivek" in /var/www , copied default index.html , edited elements.

added file "vivek.com" in /etc/apache2/sites-available

contents of file "vivek.com" follows
----------------------------->>

# ensure apache listens on port 80
listen 80

# listen virtual host requests on 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 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 all
</directory>

scriptalias /cgi-bin/ /usr/lib/cgi-bin/
<directory "/usr/lib/cgi-bin">
allowoverride none
options +execcgi -multiviews +symlinksifownermatch
order allow,deny
allow 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 all
allow 127.0.0.0/255.0.0.0 ::1/128
</directory>

</virtualhost>


--------------------------------------------->>>>>>>>>>


i.e i've added these following lines ---->>

# ensure apache listens on port 80
listen 80

# listen virtual host requests on 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 all
</directory>

</virtualhost>


---------------->>
default file present in "sites-available" folder(took of default file before editing it)

added in 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 following operations no errors:

root@vivek-pc:~# a2ensite vivek.com
enabling site vivek.com.
run '/etc/init.d/apache2 reload' activate new configuration!
root@vivek-pc:~# /etc/init.d/apache2 reload
* reloading web server config apache2

when entered www.vivek.com,it gave me default index.html in /var/www not 1 present in folder /var/www/vivek edited.

later,i edited index.html /var/www still getting same index.html(default-before editing). index.html's've been edited apache seems have hidden 1 keeps coming when request www.vivek.com

, ironic thing is,once after restart -- apache came fine site -- www.vivek.com failed show (even index.html which's hidden god knows where!!).. now,my browser showing "unable connect " ..


please help.i've been trying set since week no successful result.

quote posted mvivekc view post
ubuntu 11.04 installed apache2 , relevant packages installed

tried of blogs , made google , other forums best friends,yet unable solve issue.

need setup named virtual host on local system development.

created directory "vivek" in /var/www , copied default index.html , edited elements.

added file "vivek.com" in /etc/apache2/sites-available

contents of file "vivek.com" follows
----------------------------->>

# ensure apache listens on port 80
listen 80

# listen virtual host requests on 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 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 all
</directory>

scriptalias /cgi-bin/ /usr/lib/cgi-bin/
<directory "/usr/lib/cgi-bin">
allowoverride none
options +execcgi -multiviews +symlinksifownermatch
order allow,deny
allow 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 all
allow 127.0.0.0/255.0.0.0 ::1/128
</directory>

</virtualhost>


--------------------------------------------->>>>>>>>>>


i.e i've added these following lines ---->>

# ensure apache listens on port 80
listen 80

# listen virtual host requests on 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 all
</directory>

</virtualhost>


---------------->>
default file present in "sites-available" folder(took of default file before editing it)

added in 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 following operations no errors:

root@vivek-pc:~# a2ensite vivek.com
enabling site vivek.com.
run '/etc/init.d/apache2 reload' activate new configuration!
root@vivek-pc:~# /etc/init.d/apache2 reload
* reloading web server config apache2

when entered www.vivek.com,it gave me default index.html in /var/www not 1 present in folder /var/www/vivek edited.

later,i edited index.html /var/www still getting same index.html(default-before editing). index.html's've been edited apache seems have hidden 1 keeps coming when request www.vivek.com

, ironic thing is,once after restart -- apache came fine site -- www.vivek.com failed show (even index.html which's hidden god knows where!!).. now,my browser showing "unable connect " ..


please help.i've been trying set since week no successful result.
i'm not sure if name makes difference try renaming vivek.com file vivek-com.conf. run:

code:
sudo a2ensite vivek-com
-- l. james

--
l. d. james
ljames@apollo3.com
www.apollo3.com/~ljames


Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [SOLVED] How to create a virtual host??


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support