# install tools:
sudo yum install centos-release-scl.noarch nano bash-completion net-tools wget curl lsof
# install dependencies:
sudo yum install git openssh-clients gettext-devel openssl openssl-devel zlib-devel curl sendmail python perl-CPAN perl-devel perl perl-Net-SSLeay openssl perl-IO-Tty perl-Encode-Detect
# install apache:
sudo yum install httpd
sudo systemctl enable httpd.service
sudo systemctl start httpd.service
sudo systemctl status httpd.service
# install PHP 7.0 (instructions from authorized repo: https://wiki.centos.org/HowTos/php7):
sudo yum install rh-php70 rh-php70-php rh-php70-php-mysqlnd rh-php70-php-fpm rh-php70-php-gd rh-php70-php-ldap prh-php70-hp-odbc rh-php70-php-pear rh-php70-php-xml rh-php70-php-xmlrpc rh-php70-php-mbstring rh-php70-php-snmp rh-php70-php-soap rh-php70-curl rh-php70-curl-devel rh-php70-php-cli rh-php70-php-ldap rh-php70-php-pdo rh-php70-php-pear
# enable & start rh-php70 (php-fpm) service:
sudo semanage port -a -t http_port_t -p tcp 9000
sudo systemctl enable rh-php70-php-fpm.service
sudo systemctl start rh-php70-php-fpm.service
sudo systemctl status rh-php70-php-fpm.service
# configure httpd daemon to use rh-php70 service (optional):
sudo vi /etc/opt/rh/rh-php70/php-fpm.d/www.conf
# PHP scripts setup:
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/var/www/html
Alias / /var/www/html/
# create symbolic link to allow running PHP cli:
sudo ln -s /opt/rh/rh-php70/root/usr/bin/php /usr/bin/php
sudo scl enable rh-php70 ‘php -v’
sudo systemctl restart httpd
sudo updatedb
## also to consider:
# https://www.tecmint.com/apache-virtual-hosting-in-centos/
for mod_php: /etc/httpd/conf.d/php.conf
for php-fpm: /etc/php-fpm.d/*conf
# install MySQL 5.7:
# download the package (https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/):
wget https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
# install the package:
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
sudo yum install mysql-server
sudo yum-config-manager –disable mysql56-community mysql80-community
sudo systemctl enable mysqld.service
sudo systemctl start mysqld.service
sudo systemctl status mysqld.service
sudo grep ‘temporary password’ /var/log/mysqld.log
{{
To remove the validate password plugin:
1. Login to the mysql server as root mysql -h localhost -u root -p
2. Run the sql command: uninstall plugin validate_password;
}}
mysql -h localhost -u root -p i!koJgLQC3
> IncludeOptional sites-enabled/*.conf
# create a configuration file for your project:
sudo nano /etc/httpd/sites-available/wordpress.centos.conf
# add the following vhost definition:
ServerAdmin [email protected]
ServerName wordpress.centos
ServerAlias wordpress.centos
DocumentRoot /var/www/wordpress/public_html
HostNameLookups off
IdentityCheck off
ErrorLog /var/www/wordpress/error.log
CustomLog /var/www/wordpress/requests.log
<Directory “/var/www/wordpress/public_html”>
Order allow,deny
Allow from all
DirectoryIndex index.php index.html
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<LocationMatch “^(.*\.php)$”>
ProxyPass fcgi://127.0.0.1:9000/var/www/wordpress/public_html
# create symbolic links to configuration files in sites-enabled
sudo ln -s /etc/httpd/sites-available/wordpress.centos.conf /etc/httpd/sites-enabled/wordpress.centos.conf