January 3, 2013

Install Apache Web Server on Red Hat Enterprise Linux 6.3 (RHEL)

In this blog I will show you how to install Apache Web Server on RHEL 6.3.

1. Install httpd package.
$ yum install httpd
2. Start Apache Web Server.
$ service httpd start

3. Check that Apache Web Server is running.

$ netstat -tulpn | grep :80
tcp        0      0 1.1.1.64:80                 0.0.0.0:*        LISTEN      

4. Open port 80 in firewall.

$ system-config-firewall

If you are planning to run JBoss behind Apache Web Server.

$ vi /etc/sysconfig/httpd

and change to

#
# The default processing model (MPM) is the process-based
# 'prefork' model.  A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
# The service must be stopped before changing this variable.
#
HTTPD=/usr/sbin/httpd.worker

Restart Apache Web Server.

$ service httpd restart 

Validate that workers are working.

$ ps -ef | grep httpd 
root      3060     1  0 10:52 ?        00:00:00 /usr/sbin/httpd.worker
apache    3062  3060  0 10:52 ?        00:00:00 /usr/sbin/httpd.worker
apache    3063  3060  0 10:52 ?        00:00:00 /usr/sbin/httpd.worker
root      3431  3231  0 11:20 pts/1    00:00:00 grep httpd

Troubleshooting

If you have trouble restart Apache Web Server after activating workers, you might need to define listening ip:port

$ vi /etc/httpd/conf/httpd.conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
Listen 1.1.1.64:80
#Listen 80

No comments: