Search Engine

Sallar

When
you’re working with Apache, you need two packages. The first is httpd, which
actually installs the Apache web server. The second is the mod_ssl package, which
provides the ability to create secure websites.

Step
1. Install the two required packages:

# yum install –y httpd mod_ssl

Step
2. Verify that the packages were installed correctly:

# rpm -qa | grep http

httpd-2.2.15-5.el6.x86_64

httpd-tools-2.2.15-5.el6.x86_64

# rpm -qa | grep ssl

mod_ssl-2.2.15-5.el6.x86_64

openssl-1.0.0-4.el6.x86_64

Step
3. With the packages installed, make sure that the service is set to start when
the system boots:

# chkconfig httpd on

Step
4. Verify your changes:

#
chkconfig httpd --list

httpd 0:off 1:off 2:on 3:on
4:on 5:on 6:off

Open
http main config file

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

DocumentRoot “/var/www/html”

Test
the config file:

# service httpd configtest

Syntax OK

# service httpd restart

Stopping httpd: [
OK ]

Starting httpd: [
OK ]

Firewall and SELinux Configuration

For
your web server to become fully functional, you need to make some security Changes.
First and foremost, the firewall needs to be opened on port 80.

Step
1. Use iptables to create the additional firewall rules:

# iptables -I INPUT -p tcp -m
tcp --dport 80 -j ACCEPT

Step
2. Save the firewall rules you have just created:

# service iptables save

Saving
firewall rules to /etc/sysconfig/iptables: [
OK ]

Step
3. Then restart the iptables service:

# service iptables restart

iptables: Flushing firewall rules: [
OK ]

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Unloading modules: [
OK ]

iptables: Applying firewall rules: [
OK ]

Some Changes required in SELinux

You
need to disable the SELinux service protection to be able to utilize basic web services.