These pages describe how I set up my Fedora Linux computer to run various types of server. This includes web, ftp, vnc, samba etc. This isn't supposed to be an authoritative or definitive "how to", there are books and web sites that can do that much better than I. What these pages do show are how I set about these tasks, some of the problems I met and how I dealt with them.
You don't have to use a huge, powerful computer to run a web server from home. The machine I'm using for this has a 1.4GHz AMD Athlon processor, 512Mb RAM and a 40Gb hard drive. My DSL connection is by Verizon. One thing worth remembering is that running a web server can place a high load on the connection and so your personal web surfing speed can be adversely affected. Verizon supplies a Fujitsu Speedport Modem and I've connected a Belkin High-speed Mode Wireless G Router to that. The Linux machine is connected by CAT5 cable to the router.
Apache Installation and Testing
Apache is one of the most used web servers. I chose to use it because it's free, has a proven track record, has a huge user base - especially useful for help, it's very configurable and because I'm already familiar with it from using it on Windows machines.
Apache may already be installed on your machine, if it isn't it can be easily installed by opening terminal and typing...
yum install httpd httpd-devel httpd-manual
Once installed, the HTTPD service has to be started. In terminal you can type...
service httpd start
httpd -k start
To start Apache in Gnome using the GUI go to Desktop > System Settings > Server Settings > Services, scroll down to httpd, highlight that entry, check the checkbox next to it so that the service runs whenever the PC is restarted and click on Start. If httpd is not in the list then you'll need to add it by going to Actions and adding the service name httpd.
Fedora Linux Gnome GUI Service Configuration Utility
Once the service is started you can open a browser window and in the address bar type...
Your browser should now show the Apache welcome screen...
Apache welcome screen
Some hints and tips on using the Apache configuration file, httpd.conf. This can be found in /etc/httpd/conf/
Any changes made to this file means the httpd server has to be restarted before they take effect. You can do this by opening a terminal and typing...
httpd -k restart
or by going to System Settings > Server Settings > Services scroll down to httpd, highlight that entry then click on Restart in the menu.
Comments in the file start with a #, these lines are not acted upon.
Make a note of any changes you make to the configuration file, this makes it much easier to re-edit the file if you do make a mistake. What I do is rather than remove or edit any lines in the file is to comment out the original line by putting a # in front of it then adding "**" to the end of that line. My new directives are then placed under the line I just commented out. The "**" makes it much easier to find the lines I've edited.
Whenever httpd.conf is saved, a copy of the original file is created with the file name httpd.conf~
The default folder for placing your HTML and other website files is /var/www/html but this can be changed by editing Apache's configuration file, /etc/httpd/conf/httpd.conf
You need to edit the file in two places. Look for the entry...
and change the path to wherever you want to keep the web files. Next, find the entry...
and change the path there too. These two paths must match for Apache to work properly.
While your editing the file you may as well change the line...
to whatever your email address is. By doing this the email address will appear on certain error pages produced by Apache and people can notify you about problems with the site.
Once you've got your domain name then the following entry needs to be found and edited...
to whatever your domain name is.
Before people can view your site you must allow http access through your firewall. To do this go to Desktop > System Settings > Security Level and Firewall and check the box next to WWW(HTTP)
Fedora firewall configuration
Domain Names and IP Addresses
It is perfectly possible, but not really feasible, to run the server without a domain name. All people have to do is enter your computer's IP address in the browser address bar. However, the reason domain names are used is so that people don't have to remember lists of IP addresses. brisray.com is a lot easier to remember than 184.108.40.206 or whatever my IP address is at the moment. Which is another problem. Even with a broadband "always on" connection the IP address sometimes changes. This means so will the number people have to type in order to find your server.
I buy my domain names from GoDaddy who are reasonably priced and offer a good, reliable service. Unfortunately, just about the only service they don't offer are dynamic DNS updates. This is needed because although broadband connections can keep the same IP number for months at a time they can sometimes change often. Without the dynamic DNS updating service whenever the IP address of the server changes you have to go to the GoDaddy site to update the domain forwarding address.
When a computer is connected to the Internet it is given an IP address. This is a 32 bit address written as four decimal numbers separated by periods and uniquely identifies that computer on the Internet. Examples of IP address are 220.127.116.11 and 127.123.23.45. An ISP (Internet Service Provider) owns a block of IP addresses. When you sign onto the Internet your ISP assigns you one of the numbers from the block. When you sign back off, the number is free to be assigned to someone else. These are dynamic IP numbers. Using a dial-up modem means apart from the slow speed, that these numbers change frequently and so isn't recommended for setting up a web server. DSL and other "always on" connections aren't too bad as the IP addresses only change when the computer is completely logged off.
A static IP address is one where the machine keeps the same IP number all the time. Some ISPs can arrange for you to have a static IP address. A domain name such as mine, brisray.com, is just for our convenience. The Internet doesn't use them. When you type brisray.com into the browser a message is passed to a DNS server and that resolves the domain name into the IP address of the computer that owns that name. GoDaddy has a free forwarding service, this means that when the IP address changes you can edit the forwarding address and this new address is sent to the DNS servers. It can take up to 72 hours for the IP address to be propagated throughout the Internet, but I usually find it's done in a couple of hours.
If you use GoDaddy's forwarding service you'll find that instead of the domain name appearing in the browser's address bar the actual IP address does. This isn't too much of a problem but may not be what you want. GoDaddy does provide URL Masking that keeps the domain name in the address bar.
GoDaddy's domain forwarding and masking options
Domain forwarding at GoDaddy
Of course this assumes you know the IP address of the server! Without a router the IP address you should enter is the IP address of the computer that is or is going to be your server. To find your IP address in Fedora type ifconfig in a terminal. The computer's IP address is given as inet addr: xxx.xxx.xxx.xxx
Routers and the Hosts file
I use a Belkin High-speed Mode Wireless G Router, the computers at home are either connected to it either using CAT5 cable, including the web server, or via the wireless capability. If you use a router the IP address of your hosted site is the WAN or outside address of the router. When this image was produced it was 18.104.22.168, at the moment it's 22.214.171.124 this is what happens using a dynamic IP address from your ISP.
The router configuration screen can be gotten to by using the routers IP address in the browser address bar. In my case it's 192.168.2.1
Router configuration page
Once set up to access your hosted web site you need simply type in the IP address of the web server, in my case 192.168.2.2
One problem I found was that once the web server was set up then whenever I typed in my hosted domain name, brisray.com, then the router configuration screen would appear. In order to stop this from happening the file /etc/hosts/ had to be edited. A new line was added...
192.168.2.2 brisray.com www.brisray.com
where, 192.168.2.2 is the IP address of the computer I'm running the web server from. Both forms of brisray.com, with and without the www, are needed for this to work properly.
The host file line
127.0.0.1 localhost.localdomain localhost
can be edited to read...
127.0.0.1 localhost.localdomain localhost brisray.com
but this is less satisfactory. Even if www.brisray.com is added to the line above then entering www.brisray.com in the browser address bar will still bring up the router configuration screen.
Unlike some configuration files, editing the hosts file does not mean having to restart the services or computer for the changes to take effect.
What the hosts file does is redirect calls for one address to another. For example using the lines above calls to brisray.com and www.brisray.com are redirected to 192.168.2.2. Calls to localhost are redirected to 127.0.01
127.0.0.1 also known as the loopback address is a special IP number. What happens is that when you use this address is that no data is actually sent to a network, it is all retained within the computer. Using this address is a good way of checking that the individual computer is set up properly for network communications. If you can't ping 127.0.0.1 using ping -c 10 127.0.0.1 in terminal then the computer probably won't be able to connect to any network properly.
Fedora IP Configuration
One advantage of using a router is that you can set up the server to have a static IP address. I've found this is of advantage because it means the machine can be accessed from other computers on your side of the router very easily. Go to Desktop > System Settings > Network which should bring up the following screen...
Fedora main Network Configuration
Highlight the eth0 line then click on Edit...
Setting a Static IP
When setting your static IP and your router is acting as a DHCP server to other computers the IP you choose must be outside the range of IP's your router will issue. This is to prevent conflicts if your router issues the same IP to another computer. The "Default gateway address" is the LAN IP address of the router.
Setting the DNS servers
Go back the main screen and click on the DNS tab. Here I've set the primary DNS to the router LAN address, the secondary and tertiary DNS address are those of my ISP. Verizon uses 126.96.36.199 to 188.8.131.52. A call to Verizon confirmed that 184.108.40.206 and 220.127.116.11 can also be used.
This page created 7th May 2005, last modified 16th July 2005