sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
## Yum Repository
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
## Install PHP 7.4
yum --enablerepo=remi-php74 install php
## Install PHP 7.3
yum --enablerepo=remi-php73 install php
## Install PHP 7.2
yum --enablerepo=remi-php72 install php
## Install PHP 7.1
yum --enablerepo=remi-php71 install php
### For PHP 7.4
yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
### For PHP 7.3
yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
### For PHP 7.2
yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
### For PHP 7.1
yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
yum --enablerepo=remi-php72 install php-fpm php-fpm-nginx php-gmp php-imap php-intl php-mbstring php-mcrypt php-pecl-imagick php-pecl-xdebug php-soap
cgi.fix_pathinfo=0
Update /etc/php-fpm.d/www.conf
### 1 Update path php-fpm.sock
listen = /var/run/php-fpm/php-fpm.sock
### 2 Change ower file php-fpm.sock
listen.owner = nginx
listen.group = nginx
### 3 Change apache to nginx
user = nginx
group = nginx
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
domain.conf
server {
listen 80;
server_name server_domain_name_or_IP;
# note that these lines are originally from the "location /" block
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}