Install Apache
Install Apache Http server
Installing apache is as simple as running just one command:
yum install httpd
And then start Apache:
service httpd start
Next, enable Apache as a CentOS service so that it will automatically start after a reboot:
systemctl enable httpd
Allow Apache Through the Firewall
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
will check the whether the --zone==public is needed next time.
And reload the firewall:
sudo firewall-cmd --reload
When it's done, open your web browser and go to http://localhost/. If the page you see the following picture, it means that the installation of the Apache web server software on this system was successful," you're golden.
Apache HTTP Server is configured by placing directives in plain text configuration files. The main configuration file is usually called httpd.conf. The location on Centos is at /etc/httpd/conf/httpd.conf.
Install MySQL (MariaDB)
yum install mariadb
2
service mariadb start
3
systemctl enable mariadb
4
mysql_secure_installation
Step Three — Install PHP
yum install php php-mysql
12
service httpd restart
23
yum install php-fpm
Step Four — Test PHP Processing on your Web Server
sudo vi /var/www/html/info.php
231
<?php phpinfo(); ?>
123
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload