Centos series compile and install php7+nginx1.12 and set up your own wordpress blog
Script installation, fast and easy. Copy to the writing software to enlarge the font, where the font is too small.
After installing nginx+php, you need to build the database location.
Database installation completed creation of database and authorization (5.7 mode)
5.7 Database initial password View
Systemctl mysqld start
[root@centos7 ~] # grep "password" / var/log/mysqld.log
2017-06-04T01:29:39.687228Z 1 [Note] A temporary password is generated for root@localhost: B > gOU6ZFr1i_
Create a library
CREATE DATABASE wordpress
Create a user because the root remote link is closed
CREATE USER 'wordpress'@'%' IDENTIFIED BY'b > gOU6ZFr1i_'
Hosts that are authorized and accessible by the user
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'%'
Finally, download wordpress and decompress it to the nginx directory.-- / data
If wordpress cannot be created automatically, please modify the configuration file.
Cp wp-config-sample.php wp-config.php (edit this file as follows)
Define ('DB_NAME',' wordpress')
/ * * MySQL database user name, please change "username_here" * / define ('DB_USER',' wordpress')
/ * * MySQL database password, please change "password_here" * / define ('DB_PASSWORD',' b > gOU6ZFr1i_')
/ * * MySQL server address * / define ('DB_HOST',' 192.168.1.201')
#! / bin/bash
# By:sadoc.blog.51cto.com
# Date:2017-06-03
# one-click installation of LNMP
# system centos6.9 64-bit
# Kernel: 2.6.32-696.3.1.el6.x86_64
# php version: PHP 7.1.5
# nginx version: 1.12.0
# Mysql version: mysql-community-5.7.18 (64-bit)
Because the database is on another one, it is not installed here, and the installation is very simple.
# download yum package on mysql official website
# wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
# mv / etc/my.cnf / etc/my.cnf.bak
# rpm-ivh mysql57-community-release-el7-11.noarch.rpm
# yum install mysql-community-server-y
#
. / etc/init.d/functions | | exit 5
Ping-c 2 www.baidu.com | | exit 6
Ntpdate time1.aliyun.com & & hwclock-w
#
Check_user= `whoami`
If ["$check_user"! = "root"]; then
Echo "Plz Use root"
Exit 1
Fi
# for nginx php
Useradd-M-s / sbin/nologin cents
#
Packages_1= "epel-release openssl-devel libxml2-devel curl-devel openjpeg openjpeg-devel geoip-devel"
Packages_2= "openjpeg-libs libjpeg libpng freetype cmake autoconf libjpeg wget"
Packages_3= "libpng-devel freetype-devel mcrypt php-mcrypt libmcrypt libmcrypt-devel"
Packages_4= "zlib-devel net-tools libxml2-devel gcc gcc-c++ zip unzip gzip krb5 perl-devel"
Packages_5= "krb5-devel glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl-devel"
Packages_6= "perl-ExtUtils-Embed automake autoconf libtool libxslt-devel make gd-devel"
# cycle twice installation
Sum=1
While (($sum > / dev/null)
[- f "$Php_1"] | | wget http://36.248.244.147/files/9030000000294763/cn2.php.net/distributions/php-7.1.5.tar.gz
My php download here has been hijacked by the shameless Great Wall Broadband.
[- f "$Pcre_1"] | | wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
[- f "$Openssl_1"] | | wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
[- d / data/wordpress] | | mkdir / data/wordpress-p
For yasuo in `ls`
Do
Tar xf $yasuo > > / dev/null 2 > & 1
Done
#
Cd nginx-1.12.0
. / configure-- prefix=/opt/app/nginx1.12.0\
-- user=cents\
-- group=cents\
-- with-file-aio\
-- with-ipv6\
-- with-http_ssl_module\
-- with-http_v2_module\
-- with-http_realip_module\
-- with-http_addition_module\
-- with-http_xslt_module=dynamic\
-- with-http_p_w_picpath_filter_module=dynamic\
-- with-http_geoip_module=dynamic\
-- with-http_sub_module\
-- with-http_dav_module\
-- with-http_flv_module\
-- with-http_mp4_module\
-- with-http_gunzip_module\
-- with-http_gzip_static_module\
-- with-http_random_index_module\
-- with-http_secure_link_module\
-- with-http_degradation_module\
-- with-http_slice_module\
-- with-http_stub_status_module\
-- with-http_perl_module=dynamic\
-- with-mail=dynamic\
-- with-mail_ssl_module\
-- with-pcre=/opt/download/pcre-8.40\
-- with-openssl=/opt/download/openssl-1.0.2k\
-- with-pcre-jit\
-- with-stream=dynamic\
-- with-stream_ssl_module\
-- with-debug
[$? = 0] | | exit 5
Make & & make install & & cd $Load
#
Cd php-7.1.5
. / configure-- prefix=/opt/app/php7.1.5\
-- with-mysql=mysqlnd\
-- with-mysqli=mysqlnd\
-- with-pdo-mysql=mysqlnd\
-- with-pdo-mysqli=mysqlnd\
-- with-iconv-dir=/usr/local/libiconv\
-- with-freetype-dir\
-- with-jpeg-dir\
-- with-png-dir\
-- with-zlib\
-- with-libxml-dir=/usr\
-- enable-xml\
-- disable-rpath\
-- enable-safe-mode\
-- enable-bcmath\
-- enable-shmop\
-- enable-sysvsem\
-- enable-inline-optimization\
-- with-curl\
-- with-curlwrappers\
-- enable-mbregex\
-- enable-mbstring\
-- with-mcrypt\
-- with-gd\
-- enable-gd-native-ttf\
-- with-openssl\
-- with-mhash\
-- enable-pcntl\
-- enable-sockets\
-- with-xmlrpc\
-- enable-zip\
-- enable-soap\
-- enable-short-tags\
-- enable-zend-multibyte\
-- enable-static-- with-xsl\
-- enable-ftp\
-- enable-fpm\
-- with-fpm-user=cents\
-- with-fpm-group=cents
[$? = 0] | | exit 5
Make & & make install & & cd
#
Ln-s / opt/app/nginx1.12.0 / opt/app/nginx > > / dev/null 2 > & 1
Ln-s / opt/app/php7.1.5 / opt/app/php > > / dev/null 2 > & 1
# Nginx configuration
\ cp / opt/app/nginx/conf/nginx.conf / opt/app/nginx/conf/nginx.conf.bak
Cat > / opt/app/nginx/conf/nginx.conf