This guide will show a basic installation of the apache webserver on Redhat 7 Linux (RHEL7). The service and installation package is called as httpd. First we need to install a base apache package httpd:
[root@rhel7 ~]# yum install httpd
Now we can start httpd service:
[root@rhel7 ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service
Check the status of httpd service:
[root@rhel7 ~]# service httpd status
Redirecting to /bin/systemctl status  httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: active (running) since Thu 2014-09-04 17:20:17 WST; 17s ago
 Main PID: 2234 (httpd)

If you get a following errors:
Sep 04 17:20:12 rhel7 httpd[2234]: AH00557: httpd: apr_sockaddr_info_get() failed for rhel7
Sep 04 17:20:12 rhel7 httpd[2234]: AH00558: httpd: Could not reliably determine 
the server's fully qualified domain name, using 127.0.0.1. Set the 'Server...his message
You can fix it by a following linux command:

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


[root@rhel7 ~]# echo 'ServerName 127.0.0.1' >> /etc/httpd/conf/httpd.conf
[root@rhel7 ~]# service httpd restart

By default the port 80 is blocked so we need to change firewall rules to enable http port:
[root@rhel7 ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
[root@rhel7 ~]# firewall-cmd --reload
At the moment you should be able to see a default Apache website when pointing your browser to your server's hostname or IP address eg. 10.1.1.110.
default apache test page on Redhat 7 Linux

At this point we can create some simple page. Once done this will also disable the above RHEL7 apache test page from apearing:
[root@rhel7 ~]# echo "APACHE on RHEL7" > /var/www/html/index.html
[root@rhel7 ~]#
Reaload your browser to see your new page:
new apache page on Redhat 7 Linux

If all went well all what needs to be done to make sure that apache webserver starts after reboot. This can be achieved by the following linux command:
[root@rhel7 ~]# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions