How To Install Apache Web Server on Centos/RHEL


How To Install Apache Web Server on Centos/RHEL

1. Install Apache:

# yum -y install httpd httpd-devel


2. Edit httpd.conf file:

# vi /etc/httpd/conf/httpd.conf


#ServerName www.example.com:80

Just Add this Line-
ServerName ip address of server:80

Check this Line-991
NameVirtualHost *:80

Last-add this line-
DocumentRoot "/var/www/html"

add this last line-

RewriteEngine on
CheckCaseOnly On


----Save & Quit (:wq)-----


make logs directory...

#mkdir /logs


3. Go to /var/www/html :


# vi index.html

Make A HTML
add those line...


<html>
<marquee direction="left">
<font size="12" color="red">
!!!....Restricted zone....!!!
</font>
</marquee>
</html>


----Save & Quit (:wq)----

# vi /etc/httpd/conf.d/192.168.100.251.conf

then paste those line

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin deb.mind009@gmail.com
  ServerName 192.168.100.251


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html
  DocumentRoot /var/www/html


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/192.168.100.251-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/192.168.100.251-access_log combined Env=!DontLog

</VirtualHost>

----Save & Quit (:wq)----

# vi /etc/httpd/conf.d/debojyoti.com.conf (FOR VIRTUAL HOSTS)

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin deb.mind009@gmail.com
  ServerName www.debojyoti.com
  ServerAlias debojyoti.comi


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php index.html
  DocumentRoot /var/www/html/debojyoti.com


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/debojyoti.com-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/debojyoti.com-access_log combined Env=!DontLog

</VirtualHost>

----Save & Quit (:wq)----

4. Start httpd Service:

# /etc/init.d/httpd start

------ DONE,Thanks-------