 |
Using
TZO with Windows and Linux versions of the Apache
web server
|
| |
Many
TZO users want to run their own web server with
multiple web sites on their home server. Using
Microsoft IIS can be a big issue with worms and
viruses, and sometimes the TZO Windows web server
can't perform some of the advanced tasks that Apache
can. |
| |
|
| |
Since Apache is the world's leading web server,
we get plenty of inquiries about running the Apache
Web server on both Windows and Linux. Apache 2.0 is a
recent release of the world's best web server, and
due to many improvements, we wanted to bring you a
tutorial on configuring the Apache server to run your
domain(s). |
| |
|
| |
In
this tutorial, we have the TZO Windows software
running on our server, and have added the domains
1.tzo.com, 2.tzo.com, and 3.tzo.com. Once we get
everything tested with these TZO subdomains, we can
purchase additional private domains from TZO and add
them into our server later once everything is
working. |
| |
|
| |
Our
Linksys NAT router has a LAN address of 10.1.1.254
and the routers WAN IP address is Dynamic, so it
could change anytime. The first thing we need to do
is download and install the Apache 2.0 server for
Windows. |
| |
|
| |
Download Apache 2.0 for Windows here: http://www.apache.org/dist/httpd/binaries/win32/
Get the file named:
apache_2.0.36-win32-x86-no_ssl.msi
* this is the latest working version without source
for Win32, Newer versions may be avail here
Documentation for Apache 2.0 is here: http://httpd.apache.org/docs-2.0/ |
| |
|
| |
Install the server by clicking on the MSI file.
Install the Apache server to the default path of
C:\Program Files\Apache Group as shown in the shot
below. |
| |
|
| |
 |
|
|
|
| |
The
Server will ask your domain name and server name, in
our case, our first and primary domain name is
1.tzo.com, and our server name is dubserver.1.tzo.com
(See Example below) |
| |
|
| |
 |
| |
|
| |
Once
the Server is installed you will see the Apache
server monitor in the System tray near the clock as
shown. The Apache Monitor icon is to the far left,
the feather with the play button in the middle. When
the server is stopped, the symbol changes to a red
stop button. |
| |
|
| |
 |
| |
|
| |
Now
that we have the Apache server running, we want to
stop the server, then edit the httpd.conf file
located in the C:\Program Files\Apache
Group\Apache2\conf directory. To Stop the server,
right click on the Apache Server monitor icon as
shown above, then click "OPEN APACHE MONITOR" - and
select the STOP button to stop the server. (See
screenshot of Apache Server Monitor
below) |
| |
|
| |
 |
| |
|
| |
Make
a backup of your httpd.conf file! Now, once you make
the backup, edit the httpd.conf in Notepad for your
name based virtual host IP, Port and virtual host
names. Open the httpd.conf file located in the
C:\Program Files\Apache Group\Apache2\conf directory
with a simple text editor such as Notepad. (See an
example of the directory below, highlighted folders
are the 2 folders mentioned here in this tutorial for
configuring and adding HTML content) |
| |
|
| |
 |
| |
|
| |
Scroll down to the bottom of the httpd.conf file
and find the section with "NameVirtualHost" as shown
below for virtual hosts. By Default, Name based
virtual hosts are turned off and we need to turn them
on and add in our virtual hosts, then restart the
server. Apache loads the .CONF file configuration
every time the server is started or restarted, so
once we save this file and restart, our changes
should be in-place. |
| |
|
| |
# Use
name-based virtual hosting.
NameVirtualHost 10.1.1.1:80
#
VirtualHost example:
# Almost any Apache directive may go into a
VirtualHost container.
# The first VirtualHost section is used for
requests without a known
# server name.
#--------------------------------------------------------------
# This is our first server domain - 1.tzo.com -
Site for user1
#--------------------------------------------------------------
<VirtualHost 10.1.1.1:80>
ServerAdmin webmaster@1.tzo.com
DocumentRoot "C:/Program Files/Apache
Group/Apache2/htdocs/1"
ServerName 1.tzo.com
ErrorLog logs/1.tzo.com-error_log
CustomLog logs/1.tzo.com-access_log common
</VirtualHost>
#--------------------------------------------------------------
# This is our second server domain - 2.tzo.com -
Site for user2
#--------------------------------------------------------------
<VirtualHost 10.1.1.1:80>
ServerAdmin webmaster@2.tzo.com
DocumentRoot "C:/Program Files/Apache
Group/Apache2/htdocs/2"
ServerName 2.tzo.com
ErrorLog logs/2.tzo.com-error_log
CustomLog logs/2.tzo.com-access_log common
</VirtualHost>
#--------------------------------------------------------------
# This is our third server domain - 3.tzo.com -
Site for user3
#--------------------------------------------------------------
<VirtualHost 10.1.1.1:80>
ServerAdmin webmaster@3.tzo.com
DocumentRoot "C:/Program Files/Apache
Group/Apache2/htdocs/3"
ServerName 3.tzo.com
ErrorLog logs/3.tzo.com-error_log
CustomLog logs/3.tzo.com-access_log common
</VirtualHost>
|
| |
|
| |
In
this example above, we have 3 domains with TZO,
1.tzo.com, 2.tzo.com, and 3.tzo.com. All of these
domains reside on our internal http server at the
internal IP address of 10.1.1.1
Note that we bolded everything that we added in for
name based virtual hosts. To UnComment a line, remove
the (#) pound sign in front of that line. To Enable
Name Based Virtual Hosts, we had to uncomment the
Name VirtualHost line and added in our LAN IP:Port -
or in this case, 10.1.1.1 is the local Web Server on
our LAN, and we run on the standard port
80. |
| |
|
| |
In
your Apache HTDOCS folder (C:\Program Files\Apache
Group\Apache2\htdocs), create a folder/directory for
each domain you have different content for. In our
case, we created 3 directories under the htdocs
folder named 1,2 and 3. |
|
|
|
| |
In
Folder 1, we put the index.html file and web pages of
the domain 1.tzo.com, in the folder 2, we placed the
index.html file of the domain 2.tzo.com along with
our web content, and so on for our third domain
3.tzo.com...Once the respective index.html files and
related html content are in the proper directories
for each domain, you are ready to edit your
httpd.conf file and add in your virtual host files.
You now want to make sure your content and folders
have been created under your htdocs folder for each
domain. Double check everything once you have
finished and then save the httpd.conf
file |
| |
|
| |
Now
you should start your server and make sure that the
server reports no errors. If the server does not run,
or reports an error, double check your httpd.conf
file again, and try using the backup file and see if
the server starts. If it does, there is a mistake in
your .conf file and try to check your editing
again. |
| |
|
| |
 |
| |
|
| |
The
FORWARDING Screen of the Linksys Cable/DSL Router,
under the ADVANCED section. |
| |
|
| |
One last step is to go into your
router configuration and open up the port 80 (Web
Server) port to your internal PC that is running
the web server. In the example above, we are
showing port 80 pointing to our internal address of
10.1.1.50 using our linksys router. To set it for
our example above, we would have to change it to
10.1.1.1 because our apache web server is running
on 10.1.1.1 and not on 10.1.1.50
Once you set the router ports to forward, run your
Apache server and it should be visible to the world
and your local LAN. Have a few friends try to hit
your server from the Internet and test your name
based virtual hosts. When requests for your web
server from the Internet reach the router, the
router then directs the web requests to the server
on port 80, and your apache server will answer the
request. It will also hand out different content
for each domain specified in your virtual
hosts!
If you have trouble with ports, and want more
information, you can see http://PortDetective.com and
you should also check out Shield's Up, a personal
security Website at http://www.grc.com These
websites can help determine what ports you have
open on the router, and Port Detective can even
help you find out if your ISP blocks these ports as
well. For more information on the Linksys cable and
DSL router, please see the Linksys website at
http://www.Linksys.com
For more help on Apache, see some of the links
below:
http://www.apache.org - the
apache.org official website
http://www.Amazon.com - Apache
Server 2.0 - A complete guide by Ryan Bloom
http://www.linuxfocus.org -
information on linux and name based virtual hosts
for 1.3
http://httpd.apache.org/docs/vhosts/mass.html
- Info on Name based virtual hosts in 1.3
See the .Conf file for Linux/Unix below for
specifics on getting your Apache server running
named based virtual hosts on Linux/Unix. This
example below is using the exact same domains
except using a Linux/Unix based file system:
LINUX httpd.conf file example:
-----------------------------
# Use name-based virtual hosting.
NameVirtualHost 10.1.1.1:80
# VirtualHost example:
# Almost any Apache directive may go into a
VirtualHost container.
# The first VirtualHost section is used for
requests without a known
# server name.
#--------------------------------------------------------------
# This is our first server domain on Linux/Unix-
1.tzo.com - Site for user1
#--------------------------------------------------------------
<VirtualHost 10.1.1.1:80>
ServerAdmin webmaster@1.tzo.com
DocumentRoot "/home/webs/Apache/1"
ServerName 1.tzo.com
ErrorLog logs/1.tzo.com-error_log
CustomLog logs/1.tzo.com-access_log common
</VirtualHost>
#--------------------------------------------------------------
# This is our second server domain on Linux/Unix-
2.tzo.com - Site for user2
#--------------------------------------------------------------
<VirtualHost 10.1.1.1:80>
ServerAdmin webmaster@2.tzo.com
DocumentRoot "/home/webs/Apache/2"
ServerName 2.tzo.com
ErrorLog logs/2.tzo.com-error_log
CustomLog logs/2.tzo.com-access_log common
</VirtualHost>
#--------------------------------------------------------------
# This is our third server domain on Linux/Unix-
3.tzo.com - Site for user3
#--------------------------------------------------------------
<VirtualHost 10.1.1.1:80>
ServerAdmin webmaster@3.tzo.com
DocumentRoot "/home/webs/Apache/3"
ServerName 3.tzo.com
ErrorLog logs/3.tzo.com-error_log
CustomLog logs/3.tzo.com-access_log common
</VirtualHost>
|
| |
|