• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install and configure Apache Web Server in CentOS 7

  • 01:15 yum install httpd
  • 02:03 cd conf
  • 03:17 cd /var/www
  • 03:31 cd html
  • 05:07 systemctl status firewalld
  • 05:32 systemctl stop firewalld
  • 06:43 systemctl enable httpd
  • 07:14 vi index.html
{{postValue.id}}

To Install and configure Apache Web Server in Cent OS 7

Introduction

Apache is open-source software that is responsible for accepting directory (HTTP) requests from internet users and delivering their aspired information in the form of files and Web pages. There is a package named httpd. Installing command of apache web server

[root@linuxhelp ~]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Installed:
  httpd.x86_64 0:2.4.6-97.el7.centos                                                                            
Dependency Installed:
  httpd-tools.x86_64 0:2.4.6-97.el7.centos                                                                      
Complete!

Changing directory Command

[root@linuxhelp ~]# cd /etc/httpd  
Listing Command
[root@linuxhelp httpd]# ls
conf  conf.d  conf.modules.d  logs  modules  run

move to the conf directory

[root@linuxhelp httpd]# cd conf
[root@linuxhelp conf]# ls
httpd.conf  httpd.conf.bkp  magic

Opening the configuration file

[root@linuxhelp conf]# vi httpd.conf

snap5 Now move into the index.html file location

[root@linuxhelp conf]# cd /var/www/html
[root@linuxhelp html]# vi index.html

1 Network command to view IP address

[root@linuxhelp html]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.6.117  netmask 255.255.255.0  broadcast 192.168.6.255
        inet6 fe80::20c:29ff:fe34:1bfa  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:34:1b:fa  txqueuelen 1000  (Ethernet)
        RX packets 4339  bytes 4780242 (4.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2357  bytes 187111 (182.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

checking firewall’s status

[root@linuxhelp html]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-08-31 04:03:53 EDT; 18min ago
     Docs: man:firewalld(1)
 Main PID: 6680 (firewalld)
    Tasks: 2
   CGroup: /system.slice/firewalld.service
           └─6680 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Aug 31 04:03:51 linuxhelp.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Aug 31 04:03:53 linuxhelp.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.

Stoping firewall and then check status

[root@linuxhelp html]# systemctl stop firewalld
[root@linuxhelp html]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Tue 2021-08-31 04:22:32 EDT; 3s ago
     Docs: man:firewalld(1)
  Process: 6680 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 6680 (code=exited, status=0/SUCCESS)

Aug 31 04:03:51 linuxhelp.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Aug 31 04:03:53 linuxhelp.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Aug 31 04:22:31 linuxhelp.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Aug 31 04:22:32 linuxhelp.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.

Checking httpd status

[root@linuxhelp html]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:httpd(8)
           man:apachectl(8)

starting and enabling the service

[root@linuxhelp html]# systemctl start httpd
[root@linuxhelp html]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

open the index.html file after chnges

[root@linuxhelp html]# vi index.html

4

with this, the installation of apache web server on centos comes to end.

Tags:
stewart
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is apache by default port number?

A

Apachce uses port 80 as the default port number.

Q

How would i change apache port number ?

A

You can change default to any other port in httpd.conf file of apache.

Q

Where you can find all configuration directories of Apache Web Server?

A

By default Apache configuration directories installed under /etc/httpd/ on (RHEL/CentOS/Fedora) and /etc/apache2 on (Debian/Ubuntu).

Q

Can we have two Apache Web servers on a single machine?

A

Yes, we can run two different Apache servers at one time on a Linux machine, but the condition for that is they should listen on different ports

Q

What do you understand by “DirectoryIndex”?

A

DirectoryIndex is the name of first file which Apache looks for when a request comes from a domain.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaiah ?
What is the use of SUID & SGID commands

How to set the special permissions to the files and folders using SUID and SGID commands...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.