The Apache HTTP Server, colloquially called Apache, is the world’s most widely used web server software. Originally based on the NCSA HTTPd server, development of Apache began in early 1995 after work on the NCSA code stalled. Apache played a key role in the initial growth of the World Wide Web quickly overtaking NCSA HTTPd as the dominant HTTP server, and has remained the most popular HTTP server since April 1996. In 2009, it became the first web server software to serve more than 100 million websites.
Installing Apache On RHEL/Cent OS…..
[root@centos7 ]# yum install apache2
Installing Apache On DEBIAN/UBUNTU System….
[root@debian~]$ sudo apt-get install apache2
Checking Wheather Apache Package Install Or Not….
[root@centos7]# rpm-q apache2
Hosting A Website And Configuring Virtual Hosts…..
root@debian:~# ls -l /etc/apache2/
-rw-r–r– 1 root root 9659 May 6 14:23 apache2.conf
drwxr-xr-x 2 root root 4096 May 6 13:19 conf.d
-rw-r–r– 1 root root 1465 Jan 31 18:35 envvars
-rw-r–r– 1 root root 31063 Jul 20 2013 magic
drwxr-xr-x 2 root root 4096 May 6 13:19 mods-available
drwxr-xr-x 2 root root 4096 May 6 13:19 mods-enabled
-rw-r–r– 1 root root 750 Jan 26 12:13 ports.conf
drwxr-xr-x 2 root root 4096 May 6 13:19 sites-available
drwxr-xr-x 2 root root 4096 May 6 13:19 sites-enabled
Virtual Hosting Configuration:
Disable the default Apache virtual host by entering the following command:
root@debian:~# sudo a2dissite *default Navigate to your /var/www directory:
root@debian:~# cd /var/www
Create a folder to hold your website by entering the following command, replacing ‘abc.com’ with your domain name:
root@debian:~# sudo mkdir abc.com
Create a set of folders inside the folder you’ve just created to store your website’s files, logs, and backups. Enter the following command, replacing abc
.com with your domain name:
root@debian:~# sudo mkdir -p abc.com/public_html
root@debian:~# sudo mkdir -p abc.com/log
root@debian:~# sudo mkdir -p abc.com/backups
Create the virtual host file for your website by entering the following command. Replace the abc
.com in abc
.com.conf with your domain name:
root@debian:~# sudo nano /etc/apache2/sites-available/abc.com.conf
Now it’s time to create a configuration for your virtual host.
edit the configuration file (/etc/apache2/sites-available/abc.com.conf)
# domain: abc.com # public: /var/www/abc.com/public_html/ <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin email@example.com ServerName www.abc.com ServerAlias abc.com # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /var/www/abc.com/public_html # Log file locations LogLevel warn ErrorLog /var/www/abc.com/log/error.log CustomLog /var/www/abc.com/log/access.log combined </VirtualHost>