Virtual Directory in Apache
Hi
This is my fifth post. I am going to start how creating Virtual Directory for Document Root using Apache.
We have to put our application in the Document Root in order to make the application accessible from the Network.
Document Root
Step 3
We need to setup the virtual host configuration for two nodes.
<VirtualHost sreemandira.com/>
ServerAdmin webmaster@sreemandira.com
DocumentRoot /var/www/sreemandira.com
ServerName sreemandira.com
ServerAlias www.sreemandira.com
ErrorLog /var/logs/httpd/sreemandira.com/error_log
CustomLog /var/logs/httpd/sreemandira.com/access_log common
</VirtualHost>
Code for sreemandira.net Domain :
<VirtualHost sreemandira.net/>
ServerAdmin webmaster@sreemandira.net
DocumentRoot /var/www/sreemandira.net
ServerName sreemandira.net
ServerAlias www.sreemandira.net
ErrorLog /var/logs/httpd/sreemandira.net/error_log
CustomLog /var/logs/httpd/sreemandira.net/access_log common
</VirtualHost>
Save and close the file and restart the Apache 2
/etc/init.d/httpd restart
Make sure both the domains point to the same 10.0.90.06. Both the nodes sreemandira.com and sreemandira.net sending request to the same server.
Make sure var/log/httpd/domain name point to the appropriate user directory.
Next blog I will explain about how we can access web application outside Document Root.
Hi
This is my fifth post. I am going to start how creating Virtual Directory for Document Root using Apache.
We have to put our application in the Document Root in order to make the application accessible from the Network.
Document Root
The
document root is a directory (a folder) that is stored on your host's servers
and that is designated for holding web pages. When someone else looks at your
web site, this is the location they will be accessing.
For a website to be accessible to visitors, it must be published to
the correct directory, the "document root."
Document Root is the
"www" directory, but of course your host may well use a
different folder.
1. htdocs 2. httpdocs 3.html 4. public_html 5. web 6. empty — no value.
Your host may even have several folders nested inside each other, one of
which is the document root. In the example above the document root was:
/www/
but your host may use something like
one of these:
/web/public/
/example.com/www/public/
/example.com/public_html/
Virtual Host
Virtual Host refers to the practice of running more than one
web site on a single machine.
Virtual Host are of two types
1. IP Based - We have different IP Address for for every website.
2. Name Based - Multiple Names running on the each IP Address.
Named Virtual Hosts
NameVirtualHost
directive you specify the IP address on which the server will receive requests
for the name-based virtual hosts. This will usually be the address to which
your name-based virtual host names resolve.
We need to configure two website www.sreemandira.com and www.sreemandira.org using Virtual Host.
Step 1
We need to configure the IP Address in httpd.conf file.
sudo nano /etc/httpd/httpd.conf
Step 2
We need to set the NameVirtualHost in httpd.conf file.
Step 1
We need to configure the IP Address in httpd.conf file.
sudo nano /etc/httpd/httpd.conf
Step 2
We need to set the NameVirtualHost in httpd.conf file.
NameVirtualHost 10.0.90.06
Step 3
We need to setup the virtual host configuration for two nodes.
Code for sreemandira.com Domain :
ServerAdmin webmaster@sreemandira.com
DocumentRoot /var/www/sreemandira.com
ServerName sreemandira.com
ServerAlias www.sreemandira.com
ErrorLog /var/logs/httpd/sreemandira.com/error_log
CustomLog /var/logs/httpd/sreemandira.com/access_log common
</VirtualHost>
Code for sreemandira.net Domain :
<VirtualHost sreemandira.net/>
ServerAdmin webmaster@sreemandira.net
DocumentRoot /var/www/sreemandira.net
ServerName sreemandira.net
ServerAlias www.sreemandira.net
ErrorLog /var/logs/httpd/sreemandira.net/error_log
CustomLog /var/logs/httpd/sreemandira.net/access_log common
</VirtualHost>
Save and close the file and restart the Apache 2
/etc/init.d/httpd restart
Make sure both the domains point to the same 10.0.90.06. Both the nodes sreemandira.com and sreemandira.net sending request to the same server.
Make sure var/log/httpd/domain name point to the appropriate user directory.
Next blog I will explain about how we can access web application outside Document Root.
No comments:
Post a Comment