centos6.9 Yum Install Lnmp (shell script)

Source: Internet
Author: User
Tags fpm install php

#!/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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.