For linux users (Fedora, centos, redhat )
For linux users, installation can be done in two ways. Either from source or using yum.
1. Installation
1.1 Installation using yum
Apache is included in standard linux repositories. So you can follow the below shown steps for installing using yum.
- Install httpd binaries.
$yum install httpd - Install http development libraries.
$yum install httpd-devel
$/etc/init.d/httpd start
Dont forget to configure apache to start automatically during system bootup. For that issue the following command:
$chkconfig httpd on
1.2 Installation from source (Applicable to both redhat as well as ubuntu variants)
- Download apache source from http://httpd.apache.org/download.cgi. At the time of writing this doc, the latest stable version is 2.2.21. So I am going ahead with that.
$cd /usr/local/src
$wget http://apache.osuosl.org//httpd/httpd-2.2.21.tar.gz - Extract the downloaded archive.
$tar -xvzf httpd-2.2.21.tar.gz - Change to the newly created extracted folder
$cd httpd-2.2.21 - Configure the source. Here you can use a lot of options like "--prefix=/usr/local" (will install apache inside that folder) "--with-apxs=/path/to/apxs/binary" (you need to install apxs separately if it is not there. For full list of options, just issue the command "./configure --help" without quotes. Here I am using only prefix option to make you understan.
$ ./configure --prefix=/etc/httpd/ - Build the configuration
$make - Finally install the source package.
$make install
2. Configuration
By default, /var/www/html is the location from which web files will be served for apache. To further configure the location and adding domain names, you can follow the below shown steps.
1. Edit the file /etc/httpd/conf/httpd.conf
2. Uncomment the line:
NameVirtualHost *
(This is used to enable name based virtualhosting feature in apache, which allows you to configure multiple domain names using single IP.
3. Now add a separate virtual host entry to the end of httpd.conf for the domain name you need to create. The entries will be like the following:
ServerName mytestdomain.com
ServerAlias www.mytestdomain.com
DocumentRoot /home/mytest/public_html
Note: 192.168.1.2 is the IP address to which the domain points.
ServerName: The name of the domain.
ServerAlias: Alternate names that can be used to fetch same contents (usually www.domainname)
DocumentRoot: The directory from which the web files are fetched from.
There are lot more configuration options available for apache. But here I have mentioned only the basic ones for creating the domain.






0 comments:
Post a Comment