Wednesday, July 27, 2016

Configuring Centos with Apache , Mysql and PHP

http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/#C6

before installing apache, fix the hostname, /etc/hosts file

=================================================
Install Apache
=================================================
# yum install httpd
LISTEN 80 , change it to any port you like
# firewall-cmd --add-service=http
# firewall-cmd --permanent --add-port=3221/tcp
# firewall-cmd --reload
# systemctl restart httpd.service
# systemctl start httpd.service
# systemctl enable httpd.service
=================================================
Install PHP
=================================================
# yum install php
# systemctl restart httpd.service
test php
# echo -e ""  > /var/www/html/phpinfo.php
# php /var/www/html/phpinfo.php

=================================================
Install MariaDB
=================================================
# yum install mariadb-server mariadb
# systemctl start mariadb.service
# systemctl enable mariadb.service
# firewall-cmd --add-service=mysql
secure mariadb using below
# /usr/bin/mysql_secure_installation

=================================================
phpmyadmin
=================================================
http://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-centos-7/


rpm -iUvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum -y update

yum -y install phpmyadmin

vim /etc/httpd/conf.d/phpMyAdmin.conf
Require ip 127.0.0.1

Allow from 127.0.0.1

Require ip 127.0.0.1

Allow from 127.0.0.1

Then exit and save the file with the command :wq .

Restart Apache:

systemctl restart httpd

=================================================
Hardening Centos Apache
=================================================
disable http track and trace methods
=================================================
in /etc/httpd/conf/httpd.conf

TraceEnable off
ServerTokens ProductOnly
ServerSignature Off

The above two lines are to hide server version etc..

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More