#!/bin/bash
echo "....... ....... CentOS Release 6.9 (Final) ........... ... "
echo "############################# nginx ################################"
Service Iptables Stop
Yum Install Nginx-y
Chkconfig Nginx on
Service Nginx Start &&
echo "*****************nginx installed successfully*************************"
echo "############################# MySQL ################################"
Yum install MySQL mysql-server mysql-devel-y
Service mysqld Start
Chkconfig--levels 235 mysqld on
mysqladmin-u root Password "123456"
Service mysqld Restart
echo "*****************mysql installed successfully*************************"
echo "############################# php ################################"
Yum Install PHP php-fpm-y
Yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-b Cmath Php-mhash libmcrypt-y
Chkconfig PHP-FPM on
Cat >/etc/nginx/conf.d/default.conf<<eof
#
# The default server
#
server {
Listen default_server;
Listen [::]:80 default_server;
server_name _;
# root/usr/share/nginx/html;
root/var/www/html;
# Load configuration files for the default server block.
include/etc/nginx/default.d/*.conf;
Location/{
}
Error_page 404/404.html;
Location =/40x.html {
}
Error_page 502 503 504/50x.html;
Location =/50x.html {
}
Location ~ \.php$ {
root/var/www;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename/var/www\ $fastcgi _script_name;
Include Fastcgi_params;
}
}
Eof
Sed-i "S#user = Apache#user = nginx#g"/etc/php-fpm.d/www.conf
Sed-i "S#group = Apache#group = nginx#g"/etc/php-fpm.d/www.conf
Chown nginx.nginx/var/www/-R
chmod 700/var/www/html-r
Service Nginx Restart &&
Service PHP-FPM Restart &&
Service PHP-FPM Restart &&
Cd/var/www &&
Cat >/var/www/b.php<<eof
<?php
Phpinfo ();
Will print out all of the PHP information
?>
Eof
Cd/var/www/html &&
Cat >/var/www/html/a.html<<eof
Eof
echo "*****************php installed successfully*************************"
echo "Test PHP for installation success: Ip/b.php"
echo "test Site Directory under page: ip/a.html"
centos6.9 Yum Install Lnmp (shell script)