Difference between revisions of "Apache Virtualhost Windows Xampp"

From MS Computech
Jump to: navigation, search
(New page: 1> Edit hosts 127.0.0.1    yourhost.com 127.0.0.1    yourhost2.com <br> 2> edit extra\httpd-vhost.conf <br>#<br># Virtual Hosts<br>#<br># If yo...)
 
Line 1: Line 1:
 
1&gt; Edit hosts  
 
1&gt; Edit hosts  
 
+
<pre>127.0.0.1&nbsp;&nbsp;&nbsp; yourhost.com
127.0.0.1&nbsp;&nbsp;&nbsp; yourhost.com  
+
127.0.0.1&nbsp;&nbsp;&nbsp; yourhost2.com </pre>
 
 
127.0.0.1&nbsp;&nbsp;&nbsp; yourhost2.com  
 
 
 
 
<br>
 
<br>
  
 
2&gt; edit extra\httpd-vhost.conf  
 
2&gt; edit extra\httpd-vhost.conf  
 +
<pre>
 +
#
 +
# Virtual Hosts
 +
#
 +
# If you want to maintain multiple domains/hostnames on your
 +
# machine you can setup VirtualHost containers for them. Most configurations
 +
# use only name-based virtual hosts so the server doesn't need to worry about
 +
# IP addresses. This is indicated by the asterisks in the directives below.
 +
#
 +
# Please see the documentation at
 +
# &lt;URL:http://httpd.apache.org/docs/2.2/vhosts/&gt;
 +
# for further details before you try to setup virtual hosts.
 +
#
 +
# You may use the command line option '-S' to verify your virtual host
 +
# configuration.
 +
# Use name-based virtual hosting.
 +
#
 +
NameVirtualHost xx.xx.xx.xx:80
 +
# VirtualHost example:
 +
# Almost any Apache directive may go into a VirtualHost container.
 +
# The first VirtualHost section is used for all requests that do not
 +
# match a ServerName or ServerAlias in any &lt;VirtualHost&gt; block.
 +
#
 +
##&lt;VirtualHost *:80&gt;
 +
## ServerAdmin [email protected]
 +
## DocumentRoot /www/docs/dummy-host.example.com
 +
## ServerName dummy-host.example.com
 +
## ServerAlias www.dummy-host.example.com
 +
## ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
 +
## CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
 +
##&lt;/VirtualHost&gt;&lt;VirtualHost *:80&gt;
 +
## ServerAdmin [email protected]
 +
## DocumentRoot /www/docs/dummy-host2.example.com
 +
## ServerName dummy-host2.example.com
 +
## ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
 +
## CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common
 +
##&lt;/VirtualHost&gt;
  
<br>#<br># Virtual Hosts<br>#<br># If you want to maintain multiple domains/hostnames on your<br># machine you can setup VirtualHost containers for them. Most configurations<br># use only name-based virtual hosts so the server doesn't need to worry about<br># IP addresses. This is indicated by the asterisks in the directives below.<br>#<br># Please see the documentation at <br># &lt;URL:http://httpd.apache.org/docs/2.2/vhosts/&gt;<br># for further details before you try to setup virtual hosts.<br>#<br># You may use the command line option '-S' to verify your virtual host<br># configuration.
 
 
#<br># Use name-based virtual hosting.<br>#<br>NameVirtualHost 202.44.53.102:80
 
 
#<br># VirtualHost example:<br># Almost any Apache directive may go into a VirtualHost container.<br># The first VirtualHost section is used for all requests that do not<br># match a ServerName or ServerAlias in any &lt;VirtualHost&gt; block.<br>#<br>##&lt;VirtualHost *:80&gt;<br>## ServerAdmin [email protected]<br>## DocumentRoot /www/docs/dummy-host.example.com<br>## ServerName dummy-host.example.com<br>## ServerAlias www.dummy-host.example.com<br>## ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log<br>## CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common<br>##&lt;/VirtualHost&gt;
 
 
##&lt;VirtualHost *:80&gt;<br>## ServerAdmin [email protected]<br>## DocumentRoot /www/docs/dummy-host2.example.com<br>## ServerName dummy-host2.example.com<br>## ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log<br>## CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common<br>##&lt;/VirtualHost&gt;
 
 
## Virtual Host<br># MSCOMPUTE.COM
 
 
&lt;VirtualHost 202.44.53.102:80&gt;<br>ServerAdmin [email protected]<br>ServerName www.mscompute.com<br>ServerAlias *.mscompute.com mscompute.com
 
 
# Indexes + Directory Root.<br>DirectoryIndex index.html index.php index.htm<br>DocumentRoot C:/xampp/htdocs/mscompute/htdocs
 
 
# CGI Directory<br>ScriptAlias /cgi-bin/ C:/xampp/htdocs/mscompute/cgi-bin/<br>&lt;Location /cgi-bin&gt;<br>Options +ExecCGI<br>&lt;/Location&gt;
 
  
<br># Logfiles<br>ErrorLog C:/xampp/htdocs/mscompute/logs/error.log<br>CustomLog C:/xampp/htdocs/mscompute/logs/access.log combined<br>&lt;/VirtualHost&gt;
+
# Virtual Host
 +
# MSCOMPUTE.COM
  
## Dmzstrom.com &gt;&gt; Redirect<br>#<br>&lt;VirtualHost xx.xx.xx.xx:80&gt;<br>ServerAdmin [mailto:webmaster@host.com [email protected]]<br>ServerName www.host.com<br>ServerAlias *.host.com&nbsp;host.com
+
&lt;VirtualHost xx.xx.xx.xx:80&gt;
 +
ServerAdmin webmaster@mscompute.com
 +
ServerName host.com
 +
ServerAlias *.mscompute.com mscompute.com
 +
Indexes + Directory Root.
 +
DirectoryIndex index.html index.php index.htm
 +
DocumentRoot C:/xampp/htdocs/host/htdocs
 +
CGI Directory
 +
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host/cgi-bin/
 +
&lt;Location /cgi-bin&gt;
 +
Options +ExecCGI
 +
&lt;/Location&gt;
 +
# Logfiles
 +
ErrorLog C:/xampp/htdocs/host/logs/error.log
 +
CustomLog C:/xampp/htdocs/host/logs/access.log combined
 +
&lt;/VirtualHost&gt;
  
# Indexes + Directory Root.<br>DirectoryIndex index.html index.php index.htm<br>DocumentRoot C:/xampp/htdocs/host/htdocs/
+
#============================================================
  
# CGI Directory<br>ScriptAlias /cgi-bin/ C:/xampp/htdocs/host/cgi-bin/<br>&lt;Location /cgi-bin&gt;<br>Options +ExecCGI<br>&lt;/Location&gt;
+
#host1.com &gt;&gt; Redirect
 +
#
 +
&lt;VirtualHost xx.xx.xx.xx:80&gt;
 +
 +
ServerName www.host.com
 +
ServerAlias *.host.com&nbsp;host.com
 +
Indexes + Directory Root.
 +
DirectoryIndex index.html index.php index.htm
 +
DocumentRoot C:/xampp/htdocs/host1/htdocs/
 +
CGI Directory
 +
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host1/cgi-bin/
 +
&lt;Location /cgi-bin&gt;
 +
Options +ExecCGI
 +
&lt;/Location&gt;
 +
# Logfiles
 +
ErrorLog C:/xampp/htdocs/host1/logs/error.log
 +
CustomLog C:/xampp/htdocs/host1/logs/access.log combined
 +
&lt;/VirtualHost&gt;
  
<br># Logfiles<br>ErrorLog C:/xampp/htdocs/host/logs/error.log<br>CustomLog C:/xampp/htdocs/host/logs/access.log combined<br>&lt;/VirtualHost&gt;
+
#================================================================
 +
# host2.com
 +
&lt;VirtualHost xx.xx.xx.xx:80&gt;
 +
ServerAdmin [email protected]
 +
ServerName www.host2.com
 +
ServerAlias *.host2.com&nbsp;host2.com
 +
Indexes + Directory Root.
 +
DirectoryIndex index.html index.php index.htm
 +
DocumentRoot C:/xampp/htdocs/host2/htdocs
 +
CGI Directory
 +
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host2/cgi-bin/
 +
&lt;Location /cgi-bin&gt;
 +
Options +ExecCGI
 +
&lt;/Location&gt;
 +
# Logfiles
 +
ErrorLog C:/xampp/htdocs/rapid4dl/logs/error.log
 +
CustomLog C:/xampp/htdocs/rapid4dl/logs/access.log combined
 +
&lt;/VirtualHost&gt;
  
# host2.com<br>&lt;VirtualHost xx.xx.xx.xx:80&gt;<br>ServerAdmin [email protected]<br>ServerName www.host2.com<br>ServerAlias *.host2.com&nbsp;host2.com
+
#=======================================================
 +
# host3.com
  
# Indexes + Directory Root.<br>DirectoryIndex index.html index.php index.htm<br>DocumentRoot C:/xampp/htdocs/host2/htdocs/
+
&lt;VirtualHost xx.xx.xx.xx:80&gt;
 
+
ServerAdmin [email protected]
# CGI Directory<br>ScriptAlias /cgi-bin/ C:/xampp/htdocs/host2/cgi-bin/<br>&lt;Location /cgi-bin&gt;<br>Options +ExecCGI<br>&lt;/Location&gt;
+
ServerName [http://www.host3.com host3.com]
 
+
ServerAlias *.host3.com host3.com
<br># Logfiles<br>ErrorLog C:/xampp/htdocs/rapid4dl/logs/error.log<br>CustomLog C:/xampp/htdocs/rapid4dl/logs/access.log combined<br>&lt;/VirtualHost&gt;
+
Indexes + Directory Root.
 
+
DirectoryIndex index.html index.php index.htm
#<br># host3.com<br><br>&lt;VirtualHost xx.xx.xx.xx:80&gt;<br>ServerAdmin [email protected]<br>ServerName [http://www.host3.com host3.com]<br>ServerAlias *.host3.com host3.com
+
DocumentRoot C:/xampp/htdocs/host3/htdocs/
 
+
CGI Directory
# Indexes + Directory Root.<br>DirectoryIndex index.html index.php index.htm<br>DocumentRoot C:/xampp/htdocs/host3/htdocs/
+
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host3/cgi-bin/
 
+
&lt;Location /cgi-bin&gt;
# CGI Directory<br>ScriptAlias /cgi-bin/ C:/xampp/htdocs/host3/cgi-bin/<br>&lt;Location /cgi-bin&gt;<br>Options +ExecCGI<br>&lt;/Location&gt;
+
Options +ExecCGI
 
+
&lt;/Location&gt;
<br># Logfiles<br>ErrorLog C:/xampp/htdocs/host3/logs/error.log<br>CustomLog C:/xampp/htdocs/host3/logs/access.log combined<br>&lt;/VirtualHost&gt;
+
# Logfiles
 
+
ErrorLog C:/xampp/htdocs/host3/logs/error.log
<br>
+
CustomLog C:/xampp/htdocs/host3/logs/access.log combined
 +
&lt;/VirtualHost&gt;
 +
</pre>

Revision as of 14:10, 3 December 2008

1> Edit hosts

127.0.0.1    yourhost.com
127.0.0.1    yourhost2.com 


2> edit extra\httpd-vhost.conf

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
# Use name-based virtual hosting.
#
NameVirtualHost xx.xx.xx.xx:80
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
## ServerAdmin [email protected]
## DocumentRoot /www/docs/dummy-host.example.com
## ServerName dummy-host.example.com
## ServerAlias www.dummy-host.example.com
## ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
## CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost><VirtualHost *:80>
## ServerAdmin [email protected]
## DocumentRoot /www/docs/dummy-host2.example.com
## ServerName dummy-host2.example.com
## ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
## CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common
##</VirtualHost>


# Virtual Host
# MSCOMPUTE.COM

<VirtualHost xx.xx.xx.xx:80>
ServerAdmin [email protected]
ServerName host.com
ServerAlias *.mscompute.com mscompute.com
Indexes + Directory Root.
DirectoryIndex index.html index.php index.htm
DocumentRoot C:/xampp/htdocs/host/htdocs
CGI Directory
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog C:/xampp/htdocs/host/logs/error.log
CustomLog C:/xampp/htdocs/host/logs/access.log combined
</VirtualHost>

#============================================================

#host1.com >> Redirect
#
<VirtualHost xx.xx.xx.xx:80>
ServerAdmin [mailto:[email protected] [email protected]]
ServerName www.host.com
ServerAlias *.host.com host.com
Indexes + Directory Root.
DirectoryIndex index.html index.php index.htm
DocumentRoot C:/xampp/htdocs/host1/htdocs/
CGI Directory
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host1/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog C:/xampp/htdocs/host1/logs/error.log
CustomLog C:/xampp/htdocs/host1/logs/access.log combined
</VirtualHost>

#================================================================
# host2.com
<VirtualHost xx.xx.xx.xx:80>
ServerAdmin [email protected]
ServerName www.host2.com
ServerAlias *.host2.com host2.com
Indexes + Directory Root.
DirectoryIndex index.html index.php index.htm
DocumentRoot C:/xampp/htdocs/host2/htdocs
CGI Directory
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host2/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog C:/xampp/htdocs/rapid4dl/logs/error.log
CustomLog C:/xampp/htdocs/rapid4dl/logs/access.log combined
</VirtualHost>

#=======================================================
# host3.com

<VirtualHost xx.xx.xx.xx:80>
ServerAdmin [email protected]
ServerName [http://www.host3.com host3.com]
ServerAlias *.host3.com host3.com
Indexes + Directory Root.
DirectoryIndex index.html index.php index.htm
DocumentRoot C:/xampp/htdocs/host3/htdocs/
CGI Directory
ScriptAlias /cgi-bin/ C:/xampp/htdocs/host3/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog C:/xampp/htdocs/host3/logs/error.log
CustomLog C:/xampp/htdocs/host3/logs/access.log combined
</VirtualHost>