Install PHP on Nginx ( L E M P )
yum update -y yum install epel-release -y yum install nginx -y systemctl start nginx systemctl enable nginx firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload yum install mariadb-server mariadb -y systemctl start mariadb systemctl enable mariadb mysql_secure_installation yum install yum-utils http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y yum-config-manager –enable remi-php73 yum install php php-fpm -y sed -i '12s#.*#listen = /run/php-fpm/www.sock#' /etc/php-fpm.d/www.conf sed -i '31s#.*#listen.owner = nginx#' /etc/php-fpm.d/www.conf sed -i '32s#.*#listen.group = nginx#' /etc/php-fpm.d/www.conf sed -i '39s#.*#user = nginx#' /etc/php-fpm.d/www.conf sed -i '41s#.*#group = nginx#' /etc/php-fpm.d/www.conf chown -R root:nginx /var/lib/php systemctl start php-fpm systemctl enable php-fpm echo -e "nserver {ntlisten 80;ntserver_name your_server_ip;nntroot /usr/share/nginx/html;ntindex index.php index.html index.htm;nntlocation / {ntttry_files $uri $uri/ =404;nt}nterror_page 404 /404.html;nterror_page 500 502 503 504 /50x.html;ntlocation = /50x.html {nttroot /usr/share/nginx/html;nt}nntlocation ~ .php$ {ntttry_files $uri =404;nttfastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;nttfastcgi_index index.php;nttfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;ntt include fastcgi_params;nt}n}" | tee /etc/nginx/conf.d/default.conf systemctl restart nginx
https://www.veerotech.net/kb/how-to-install-nginx-mysql-php-v7-lemp-stack-on-centos-7/
Category:
IT , Technical Hacks etc
Posted on:
November 1st, 2024