Apache Web server
For all of those who have asked me how a web server works and how to install one, here is your answer… To set up a web server, you don't need a lot of money, if you can afford a DSL connection; with at least 1 static IP then you are in business.
Requirements for the web server
- DSL connection with Static IP address
- Linux Operating System
- Apache web server
- Pentium MMX +
If you are planning to set up a live web server, make sure you get a static IP Address from your Internet service provider. Also for a live web server you need to register a domain name, something like (yourcompany.com).
Be aware that some companies charge up to $35.00 and others $10.00 or $15.00 for the same domain name. Shop around before you register your domain.
Note. When setting up a big network it is quite often referred to running a DNS (Domain name Server) however it is not required to run a single web sever because your internet service provider will help you with that; I mean it is your right to request this service that's why you are paying for it.
Let's get started by assigning an IP address to the system. In this example I will use a /29 network; this is a subnet mask of 255.255.255.248. For more information on networks read chapter 8.
Note. When you acquire your Internet connection, your ISP will assign you a subnet mask that will limit your number of hosts according to the package in your contract.
The example in this book will be exactly the same as what you will configure with your IP addresses, all you have to do is just substitute the IP addresses.
Typical static configuration
Let's assume your account includes 5 static IPS. Then your router will actually be configured as follows:
Look at the table below, this is the information sent to you by your ISP.
|YOUR ROUTER SIDE||YOUR NETWORK SIDE|
|Router IP||184.108.40.206|| First available IP||220.127.116.11|
|Gateway IP||18.104.22.168||Second available IP||22.214.171.124|
|Subnet mask||255.255.255.248||Third available IP||126.96.36.199|
|First ISP's DNS||188.8.131.52||Fourth available IP||184.108.40.206|
|Second ISP's DNS||220.127.116.11||Fifth available IP||18.104.22.168|
Following table 9.1, we are going to configure our computer:
- From the console or graphical, Start: linuxconf (if you logged on as regular user, the root password will be requested)
- On the run command type:
- Enter the password and hit Enter
- Once the linuxconf control panel opens, from the Config tab click on Networking
- From the Client task tab click on: Host name and IP network Devices
Look at figure 9.2. This is what we need. If you are ready and have your domain name, this is where you will use it. If you don't have a domain name yet but you need to practice these configurations, use anything like terminator.com, learningcenter.net etc.
Host name: The host name is the actual name of the computer and can be called whatever you want such as computerx, serverx or yourname, etc.
Domain: This is the registered domain name, such as: yourcompany.com
The next tabs from figure 9.3 are the adaptors 1,2,3,4. This means that in a single machine you can add up to four NICs (Network Interface Cards).
Click on Adaptor 1 to set the configurations.
Observe Figure 9.3 this is the first adapter and it is directly connected to the Internet.
Referring to table 10.1, since the router is using 22.214.171.124 and 126.96.36.199, my first available-useable IP is: 188.8.131.52; I will assign this to my first computer (first host).
My first host in this network will be a web server in a domain called netcontrol.org.
Please note carefully, what is selected in this picture.
- The adaptor must be set as enabled. If you fail to observe this, the network card will not be active even if you have the correct settings.
-  The config mode must be Manual because it is a static IP.
-  You can use DHCP only when you are setting up a workstation and the IP assignation is being done through the DHCP server (Dynamic Host Configuration Protocol)
-  The BootP, is similar as the DHCP at boot time an IP address is assigned to the NIC (Network Interface Card)
Primary name + domain: you already know this; it is the name of the computer + the registered domain name.
Aliases: These are the other names, how you want the computer to be known, usually the primary name.
IP Address: The physical IP address assigned to the host (this is the address in which the web server will be identified on the internet)
Netmask: This is the subnet mask, which will control how many hosts will be on the network.
Net Device: This is the physical interface card:
Eth0 = 1 (First Ethernet Adapter)
Eth1 = 2 (Second Ethernet Adapter)
Eth2 = 3 (Third Ethernet Adapter)
Eth3 = 4 (Fourth Ethernet Adapter)
Kernel Module: This is the driver that will make the Net card work. (If the driver is incorrect, the net card will not work).
Note on this picture how easy it is to identify a driver for almost any device.
Some devices allow you to run the configuration wizard here. Whenever possible try to use the manual configuration. I am sure when you learn how to do it; everything will be very simple.
IO Port: Usually, under Linux you don't need to specify an IO/address for the net card as it's handled automatically by the system. In case you are having conflicts with other hardware, read chapter 7 installing hardware for troubleshooting.
IRQ: Same as the IO port, you do not need to specify an Interrupt Request; it is automatically allocated by the system. But if you are having a conflict with another device, you may need to play with it until you find an available IRQ.
Using the same process in configuring the eth0 you can configure other net cards in the system.
Note. Each configured net card is considered as different identity, in other words different networks.
- Once all settings are entered, click on Accept.
In this stage, we are setting up a Web Server alone, and it is dependent to the ISP's DNS server.
Next, from the Client task click on: Name Server Specification (DNS)
Here you enter the DNS IP Address, provided by your Internet Service Provider. Again refer to table 9.1
The DNS provided here allows your workstation to query your ISP's server to locate the nearest route to get to the web pages you requested.
The search domain is same as the default domain. These names are not a requirement; however if you enter it, the search domain takes precedence over the default domain. Be aware that this will create more traffic within the workstation and the DNS server.
- Click on Accept to save the changes.
Note. This is a client configuration known as resolver; do not confuse this with the DNS server. We will set up a DNS later in this book.
The next step is setting the routing
From the client task click on Routing and Gateway
Click on Defaults
Refer to table 9.1 and enter your corresponding gateway IP address. Remember the gateway IP is part of the router and is also part of the IP block given to you by your ISP.
- Make sure this routing option is enabled and Click on Accept.
- Click on Dismiss
- Click on Dismiss
- Click on Quit
- Click on Do it
Restart your system…
Re-logon, to test your net card; from the console ping the IP Address:
[agustin@server2 agustin]$ ping 184.108.40.206
Look at the picture, if the response from the ping command looks similar; everything is fine. To terminate the ping command, press Ctrl + C. You should be able to browse the Internet now. If you received an unreachable message from the ping command, that means that either the net card is not enabled or the driver being used is incorrect. Refer to figure 9.3.
If that doesn't help, read chapter 2 for configuring the router and configuring the network properties. Assuming that your Internet connection is working now, we will proceed with the Web server configuration.