Posted on

WordPress on Centos 7 + Nginx + PHP 7 + Mariadb

1.Update the epel-release and install the REPO for remi-php 7
sudo yum -y install epel-release
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php72
2.add nginx REPO
sudo nano /etc/yum.repos.d/nginx.repo
add code in /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
3.install nginx , mariadb , php
sudo yum -y update
sudo yum -y install nginx mariadb-server git libpng12
yum -y install php-devel php-mysql php-opcache php-gd php-common php-xmlrpc php-mcrypt php-zip php-cli php-xml php-mbstring php-curl php-fpm 
4.Open firewall port for service
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --permanent --zone=public --add-service=ftp
sudo firewall-cmd --reload
5.Setup nginx & PHP
sudo systemctl restart nginx
sudo systemctl enable nginx
sudo vi /etc/nginx/conf.d/lab.conf
sudo vi /etc/opt/remi/php71/php.ini
   cgi.fix_pathinfo=0
sudo vi /etc /php-fpm.d/www.conf
   user = nginx
   group = nginx
   listen.owner = nobody
   listen.group = nobody
sudo systemctl restart php-fpm
sudo systemctl enable php-fpm
6.copy the wordpress rouce code to /usr/share/nginx/wordpress/
chown -R nginx:nginx /usr/share/nginx/wordpress/
sudo systemctl restart nginx
7.setup the database
sudo systemctl restart mariadb
sudo systemctl enable mariadb 
mysql_secure_installation
8.Create Database for wordpress mysql –u root –p
create database wordpress;
grant all on wordpress.* to 'wordpress'@'localhost' identified by 'password';
flush privileges;
exit