Today we will look how to Install and configure Apache httpd service on Centos 7. To do this follow steps below:
1. Open command line and Install httpd :
[root@tekbloq ~]# yum -y install httpd
2. open Apache configuration file and edit what you want:
[root@tekbloq ~]# vi /etc/httpd/conf/httpd.conf
# line 86: change to admin’s email address
ServerAdmin root@tekbloq.com
# line 95: change to your server’s name
ServerName www.tekbloq.com:80
# line 151: change
AllowOverride All
# line 164: add file name that it can access only with directory’s name
DirectoryIndex index.html index.cgi index.php
# add follows to the end
# server’s response header
ServerTokens Prod
# keepalive is ON
KeepAlive On
3. Start and enable httpd service:
[root@tekbloq ~]# systemctl start httpd
[root@tekbloq ~]# systemctl enable httpd
4. Allow the default HTTP port, ports 80 , through firewall:
[root@tekbloq ~]# firewall-cmd –add-service=http –permanent
success
[root@tekbloq ~]# firewall-cmd –reload
success
5. The document root of the default website is /var/www/html.You should place your index.html page here (in this case you can type www.tekbloq.com on browser for access web page).