how to install nginx + database + PHP on centos 7
this is tutorial to install nginx as webserver with database and PHP support on centos 7
this a command
sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
test your ip with browser..
nginx is allready running
http://server_domain_name_or_IP/
sudo systemctl enable nginx
let start install database
sudo yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation
sudo systemctl enable mariadb
and now installing php
sudo yum install php php-mysql php-fpm
sudo vi /etc/php.ini
uncomment cgi.fix_pathinfo=0
change cgi.fix_pathinfo=0 into cgi.fix_pathinfo=1
ctrl + o to save
ctrl + x to quit
sudo vi /etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nobody
listen.group = nobody
user = nginx
group = nginx
ctrl + o to save
ctrl + x to quit
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
sudo vi /etc/nginx/conf.d/default.conf
add this. watch the video to sure how to add this on script
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;
}
ctrl + o to save
ctrl + x to quit
sudo systemctl restart nginx
and try access your test file with browser. if show php info now your VPS is worked
link to VPS : https://goo.gl/TupqNI
source
centos 7