N. Achyut Uncategorized How to configure HTTP-APACHE server for Linux virtual hosting of the website successfully

How to configure HTTP-APACHE server for Linux virtual hosting of the website successfully

steps to configure HTTP-APACHE server for Linux virtual

Steps to configure HTTP-APACHE server

What is HTTP?

HTTP stands for hypertext transfer protocol; Http is used for communication between clients and the server for the purpose of request and response respectively.

To understand more about HTTP request and response, let A person request to search for colzlife.com to the HTTP and Web Server catches the request and handle it within a second. The web server processes the request and sends it back to the browser with result which means server response the request.

Steps to configure HTTP- APACHE server for Linux virtual Hosting of the website

Apache is the most popular Linux-based Web server applications in use. After the complete setup of DNS, you will need to configure Apache to accept the surfers wanting to access your Website.

Download and install Apache Package | Steps to configure HTTP-APACHE server

Most RedHat and Fedora Linux software products are available in the ROP format. When searching for the file, remember that the Apache RPM’s filename usually starts with the word httpd followed by the version number , as in httpd-2.0.48-1.2.rpm. It is best to use the latest version of Apache. When searching for the file, remember that the RedHat / Fedora Apache RPM package’s filename usually starts with the word httpd followed by a version number, as in httpd-2.0.48-1.2.rpm. With Ubuntu / Debian the package name will have the apache prefix instead.

*sudo apt-get install apache2 (In ubuntu)

Managing the Apache Server | Steps to configure HTTP-APACHE server

Managing Apache’s httpd daemon is easy to do, but the procedure differs between Linux distributions. Here are some things to keep in mind. Firstly, different Linux distributions use different daemon management systems. Each system has its own set of commands to do similar operations. The most commonly used daemon management systems are SysV and Systemd Secondly, the daemon name needs to be known. In this case the name of the daemon is httpd. Armed with this information you can know how to: Start your daemons automatically on booting, Stop, start and restart them later on during troubleshooting or when a configuration file change needs to be applied.

Configuring DNS For Apache | Steps to configure HTTP-APACHE server

Remember that you will never receive the correct traffic unless you configure DNS for your domain to make your new Linux box Web server the target of the DNS domain’s www entry.

DHCP and Apache | Steps to configure HTTP-APACHE server

As you remember, if your Internet connection uses DHCP to get its IP address, then you need to usedynamic DNS to get the correct Internet DNS entry for your Web server. If your Web server and firewallare different machines, then you probably also need to set up port forwarding for your Web traffic to reachthe Web server correctly.DHCP on your protected home network is different. The web server lives on the 192.168.1.0 homenetwork protected by a firewall.

The firewall uses NAT and port forwarding to pass Internet traffic on tothe web server. Remember that the IP address of your web server can change if it gets its IP address usingDHCP. This could cause your firewall port forwarding, not Dynamic DNS, to break.In this case, your web server on the 192.168.1.0 network uses a fixed, or static IP address that is outside ofthe range of the DHCP server to prevent you from having this problem.

General Configuration Steps

The configuration file used by Apache is /etc/httpd/conf/httpd.conf in Redhat / Fedora distributions and /etc/apache*/httpd.conf in Debian / Ubuntu distributions. As for most Linux applications, you must restart Apache before changes to this configuration file take effect.

Where To Put Your Web Pages

All the statements that define the features of each web site are grouped together inside their own <VirtualHost> section, or container, in the httpd.conf file. The most commonly used statements, ordirectives, inside a <VirtualHost> container are:

Server name: Defines the name of the website managed by the <VirtualHost> container. This is needed in named virtual hosting only.

Document Root: Defines the directory in which the web pages for the site can be found.

By default, Apache searches the DocumentRoot directory for an index, or home, page named index.html. So for example, if you have a servername of www.my-site.com with a DocumentRoot directory of /home/www/site1/, Apache displays the contents of the file /home/www/site1/index.html when you enter http://www.colzlife.com in your browser. Some editors, such as Microsoft FrontPage, create files with an .htm extension, not .html. This isn’t usually a problem if all your HTML files have hyperlinks pointing to files ending in .htm as FrontPage does.

The problem occurs with Apache not recognizing the topmost index.htm page. The easiest solution is to create a symbolic link (known as a shortcut to Windows users) called index.html pointing to the file index.htm. This then enables you to edit or copy the file index.htm with index.html being updated automatically. You’ll almost never have to worry about index.html and Apache again!

This example creates a symbolic link to index.html in the /home/www/site1 directory.

[root@bigboy tmp]# cd /home/www/site1
[root@bigboy site1]# ln -s index.htm index.html
[root@bigboy site1]# ll index.*
-rw-rw-r-- 1 root root 48590 Jun 18 23:43 index.htm
lrwxrwxrwx 1 root root 9 Jun 21 18:05 index.html -> index.htm
[root@bigboy site1]#

The l at the very beginning of the index.html entry signifies a link and the -> the link target.

Steps to configure HTTP-APACHE server for Linux virtual hosting of the website www.tu.edu.np.

At first we need to configure the web server for our domain name. This is performed in /etc/httpd directory.
Firstly, To configure the web server open a terminal window and change the directory to /etc/httpd. In this directory you will find a number of sub-directories. Change directory into the conf sub-directory where you will find an httpd.conf file which contains the configuration settings for the Apache server.


Secondly, Edit the httpd.conf file using your favorite editor using the su command to ensure you have write permission to the file. Once loaded, there are a number of settings that need to be changed to match your environment:
The Server Admin directive defines an administrative email address for people wishing to contact the webmaster for your site. Change this to an appropriate email address where you can be contacted:

ServerAdmin
admin@tu.com

Next the ServerName and ServerAlias directives need to be defined so that the web server knows whichvirtual host this configuration file refers to:
ServerName
www.tu.edu.np

Next, we need to define where the web site files are going to be located using the DocumentRoot
directive. The tradition is to use /var/www/domain-name:

Document Root
/var/www/www.tu.edu.np

Next, create the /var/www/www.tu.edu.np directory and place an index.html file in it. For example:

<html>
<title>TU page</title>
<body>
Welcome to www.tu.edu.np
</body>
</html>


The last step is to restart the apache web server to make sure it picks up our new settings:

/sbin/service httpd restart

Related Post