centos7+nginx1.11.7+mysql5.7.16+php7.1.0+openssl-1.1.0c
Linux System Limited Configuration
1, shut down the system firewall
Systemctl Stop firewalld.service shutdown firewall
systemctl Disable firewalld.service Disable firewall
2. Close SELinux
Sed-i ' s/selinux=.*/selinux=disabled/g '/etc/selinux/config
setenforce 0 SELINUX Immediate effect
Second, the system installation agreement
Software source code Package storage location:/USR/LOCAL/SRC
Source Package Compile Installation location:/usr/local/software Name
Third, download the software package
1, download the latest stable version of Nginx
Wget-p/usr/local/src http://nginx.org/download/nginx-1.11.7.tar.gz
2, download mysql-boost-5.7.16 with boost if not with the source code installation if the network environment is not likely to be an error
Wget-p/usr/local/src http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-5.7.16.tar.gz
3, download php-7.1.0 version
Wget-p/usr/local/src http://cn2.php.net/distributions/php-7.1.0.tar.gz
4, download libmemcached-1.0.18
Wget-p/usr/local/src https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gz
5, download php-memcached
Yum-y install git
cd/usr/local/src
git clone-b php7 https://github.com/php-memcached-dev/php-memcached.git
6, download openssl-1.1.0c
Wget-p/usr/local/src https://www.openssl.org/source/openssl-1.1.0c.tar.gz
Iv. Installing compilers and dependencies
Yum-y insyall epel-release
yum-y Install patch gcc gcc-c++ readline-devel zlib-devel libffi-devel \
OpenSSL Open Ssl-devel make autoconf automake libtool bison libxml2 \ libxml2-devel
libxslt-devel libyaml-devel python python-docu TILs \
cmake imake expat-devel libaio libaio-devel bzr ncurses-devel wget libjpeg libjpeg-devel libpng libpng-de
Vel freetype freetype-devel \
pcre-devel curl-devel libmcrypt
V. Compile and install mysql-boost-5.7.16 easy to install again create mysql_install.sh script
1, mysql_install.sh content
#! / bin / bash
#yum update -y
#yum install -y cmake gcc-c ++ ncurses-devel gcc make openssl *
#mysqlInstallation script
DBDIR = '/ data / mysql' #mysql data storage directory
MYSQLDIR = '/ usr / local / mysql' # mysql installation directory
PASSWD = '123456' # mysql root password installation can be remote IP login
[-d $ DBDIR] || mkdir $ DBDIR -p
id mysql &> / dev / null
if [$? -ne 0]; then
useradd mysql -s / sbin / nologin -M
fi
chown -R mysql: mysql $ DBDIR
cd / usr / local / src
tar -xvf mysql-boost-5.7.16.tar.gz
cd mysql-5.7.16
cmake .-DCMAKE_INSTALL_PREFIX = $ MYSQLDIR \
-DMYSQL_DATADIR = $ DBDIR \
-DSYSCONFDIR = / etc \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DWITH_LIBWRAP = 0 \
-DMYSQL_UNIX_ADDR = / tmp / mysql.sock \
-DWITH_SSL = system \
-DWITH_ZLIB = system \
-DWITH_BOOST = / usr / local / src / mysql-5.7.16 / boost / boost_1_59_0 \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci
if [$?! = 0]; then
echo "cmake error!"
exit 1
fi
make && make install
if [$? -ne 0]; then
echo "install mysql is failed!" && / bin / false
fi
sleep 2
chown -R mysql: mysql $ MYSQLDIR
chown -R root: root $ MYSQLDIR
cp $ MYSQLDIR / support-files / my-default.cnf /etc/my.cnf
echo export PATH = $ PATH: $ MYSQLDIR / bin: $ MYSQLDIR / lib >> / etc / profile
source / etc / profile
cat >> /etc/my.cnf << EOF
character_set_server = utf8
basedir = $ MYSQLDIR
datadir = $ DBDIR
port = 3306
server_id = 1
socket = /tmp/mysql.sock
explicit_defaults_for_timestamp = true
EOF
sed -i 's / sql_mode =. * / sql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER / g' /etc/my.cnf
source / etc / profile
sleep 5
cd $ MYSQLDIR
cp support-files / mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
mysql_ssl_rsa_setup
rm -rf $ DBDIR
mysqld --initialize --user = mysql
if [$? -ne 0]; then
echo "install mysql is failed!" && / bin / false
fi
# / etc / init.d / mysqld stop
mysqld_safe --user = mysql --skip-grant-tables --skip-networking &
sleep 5
echo "update user set authentication_string = Password ('$ PASSWD') where user = 'root'; flush privileges;" | mysql mysql
echo "set password = Password ('$ PASSWD'); flush privileges;" | mysql -u root -p $ PASSWD --connect-expired-password
sleep 5
echo "GRANT ALL PRIVILEGES ON *. * TO root @ '%' IDENTIFIED BY '$ PASSWD'; FLUSH PRIVILEGES;" | mysql -u root -p $ PASSWD
/etc/init.d/mysqld restart
if [$? -ne 0]; then
echo "install mysql is failed!" && / bin / false
fi
IDSO = `cat /etc/ld.so.conf | grep $ MYSQLDIR / lib | wc -l`
if [$ IDSO -eq 0]; then
echo "$ MYSQLDIR / lib" >> /etc/ld.so.conf
ldconfig
fi
chkconfig mysqld on
2, to mysql_install.sh executable permissions
chmod +x mysql_install.sh
3. Operation Mysql_install.sh
Vi. compiling and installing PHP7 creating PHP installation Scripts php7_install.sh
1, Vim php7_install.sh
#! / bin / bash
if [$ (find / -name mysql | wc -l) -gt 1]; then
echo "mysql is install"
else
yum install -y mysql
fi
cd / usr / local / src
tar -xzvf php-7.1.0.tar.gz
cd ./php-7.1.0
./configure \
--prefix = / usr / local / php7 \
--exec-prefix = / usr / local / php7 \
--with-config-file-path = / usr / local / php7 / etc \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir = lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--with-zlib-dir \
--with-mhash \
--with-mcrypt \
--with-openssl-dir \
--with-jpeg-dir \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
make && make install
# Chinese php drawing cancel this parameter, otherwise garbled
# --enable-gd-jis-conv \
2, to php7_install.sh executable permissions
3, the implementation of php7_install.sh
4. Compile and install libmemcached-1.0.18
Vim libmemcached_install.sh
#/!bin/bash
cd/usr/local/src
tar-zxvf libmemcached-1.0.18.tar.gz
CD./libmemcached-1.0.18
./ Configure--prefix=/usr/local/libmemcached make
&& make install
chmod +x libmemcached_install.sh
./libmemcached_install.sh
5. Compile and install php-memcached
Vim memcached_install.sh
#!/bin/bash
cd/usr/local/src/php-memcached
/usr/local/php7/bin/phpize
./configure-- with-libmemcached-dir=/usr/local/libmemcached \
--with-php-config=/usr/local/php7/bin/php-config \-
- DISABLE-MEMCACHED-SASL make
&& make install
chmod +x memcached_install.sh
./memcached_ install.sh
Note that the compilation completes the path of the build file
Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/
Vii. Compile and install openssl-1.1.0c
Vim openssl_install.sh
#!/bin/bash
#openssl Install
cd/usr/local/src
tar-xvf openssl-1.1.0c.tar.gz
cd/usr/local/src/ openssl-1.1.0c
./config--openssldir=/usr/local/ssl make
&& make install
./config Shared-- Openssldir=/usr/local/ssl make
&& make install
idso= ' cat/etc/ld.so.conf| grep/usr/ local/lib64 | Wc-l '
if [$IDSO-eq 0];then
echo "/usr/local/lib64" >>/etc/ld.so.conf
fi
ldconfig
chmod +x openssl_install.sh
./openssl_install.sh
Viii. Compiling and installing nginx-1.11.7
Vim nginx_install.sh
#!/bin/bash
cd /usr/local/src/php-memcached
/usr/local/php7/bin/phpize
./configure --with-libmemcached-dir=/usr/local/libmemcached \
--with-php-config=/usr/local/php7/bin/php-config \
--disable-memcached-sasl
make && make install
chmod +x memcached_install.sh
./memcached_install.sh
2, to nginx_install.sh executable permissions
chmod +x nginx_install.sh
./nginx_install.sh
Ix. Configuration of PHP7
/usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/memcached.so
This path is randomly variable, so be aware
Note The change completion file path
Installing Shared extensions:/usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/
cd/usr/local/src/php-7.1.0 CP Php.ini-production/usr/local/php7/etc/php.ini cp/usr/ Local/php7/etc/php-fpm.conf.default/usr/local/php7/etc/php-fpm.conf cp/usr/local/php7/etc/php-fpm.d/ www.conf.default/usr/local/php7/etc/php-fpm.d/www.conf sed-i "S/user =. */user = nginx/g"/usr/local/php7/etc/ php-fpm.d/www.conf sed-i "S/group =. */group = nginx/g"/usr/local/php7/etc/php-fpm.d/www.conf CP./sapi/fpm/ INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM chmod +x/etc/init.d/php-fpm chkconfig php-fpm on cat >>/usr/local/php7/etc/
php.ini<< EOF soap.wsdl_cache_enabled=1 max_input_time = Max_execution_time = + Date.timezone = Asia/Shanghai Post_max_size = 32M Memory_limit = 128M mbstring.func_overload = 1 extension=/usr/local/php7/lib/php/extensions/ No-debug-non-zts-20160303/memcached.so EOF cat >/usr/local/nginx/html/index.php<<eof <?php phpinfo ();? > EOF Service php-fpm start
#!/bin/bash
#openssl install
cd /usr/local/src
tar -xvf openssl-1.1.0c.tar.gz
cd /usr/local/src/openssl-1.1.0c
./config --openssldir=/usr/local/ssl
make && make install
./config shared --openssldir=/usr/local/ssl
make clean
make && make install
IDSO=`cat /etc/ld.so.conf| grep /usr/local/lib64 | wc -l `
if [ $IDSO -eq 0 ];then
echo "/usr/local/lib64" >> /etc/ld.so.conf
fi
ldconfig
chmod +x openssl_install.sh
./openssl_install.sh
X. Configuration of Nginx
1. Renaming:/etc/nginx/nginx.conf
Mv/etc/nginx/nginx.conf/etc/nginx/nginx.conf.back
2. New/etc/nginx/nginx.conf
Cat >/etc/nginx/nginx.conf << EOF
user nginx;
Worker_processes 1;
Error_log/var/log/nginx/error.log warn;
PID /var/run/nginx.pid;
Events {
worker_connections 1024;
}
HTTP {
include /etc/nginx/mime.types;
Default_type Application/octet-stream;
Log_format main ' \ $remote _addr-\ $remote _user [\ $time _local] "\ $request" "\
$status \ $body _bytes_sent" \ $http _ Referer "
" "\ $http _user_agent" "\ $http _x_forwarded_for" ";
Access_log/var/log/nginx/access.log main;
Sendfile on ;
#tcp_nopush on ;
Keepalive_timeout;
#gzip on;
include/etc/nginx/conf.d/*.conf;
}
Eof
3. Create/ETC/NGINX/CONF.D
4, create support PHP-FPM Web Nginx configuration
Cat >/etc/nginx/conf.d/default.conf << EOF server {Listen 80;
server_name localhost;
#charset Koi8-r;
#access_log Logs/host.access.log Main;
Location/{root/usr/local/nginx/html;
Index index.php index.html index.htm;
} #error_page 404/404.html;
# REDIRECT Server error pages to the static page/50x.html # Error_page 502 503 504/50x.html;
Location =/50x.html {root html; # Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ {# Proxy_pass http://127.0.0
.1; # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ {root/usr/local
/nginx/html;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params; } location ~* ^.+\.
(jpg|jpeg|gif|png|bmp) $ {access_log off;
Root OpenCart;
Expires 30d;
Break
} EOF
5. Create Nginx Startup scripts
Vim/etc/init.d/nginx
# chkconfig:2345 # Description:start and Stop nginx path=/usr/local/bin:/sbin:/usr/bin:/bin exec=/usr/sbin/ng
Inx pidfile=/var/run/nginx.pid conf= "/etc/nginx/nginx.conf" auth= "1234" case "' in Start ' if [-f $PIDFILE]
Then echo "$PIDFILE exists, process is already running or crashed." else echo "Starting Nginx server ..." $EXEC-C $CONF & FI if ["$?"
= "0"] then echo "Nginx is running ..." FI;
STOP) if [! f $PIDFILE] then echo $PIDFILE exists, the process is not running.
Else pid=$ (cat $PIDFILE) echo "Stopping ..." kill-9 $PID pid=$ (pidof nginx) kill-9 $PID Rm-rf/var/run/nginx.pid Sleep 2 While [-X $PIDFILE] do echo waiting for Nginx to Shutdow
N ... "Sleep 1" Nginx stopped "FI;
Reload) $EXEC-s reload;;
restart|force-reload) ${0} stop ${0} start;;
*) echo "Usage:/etc/init.d/nginx {start|stop|restart|force-reload|reload}" >&2 exit 1 Esac
6, to/etc/init.d/nginx executable permissions
chmod +x/etc/init.d/nginx
7. Set Boot up
8, start Nginx
XI. Testing
[root@qka169 src]# OpenSSL version OpenSSL 1.1.0c a Nov 2016 mysql-u root-p123456 mysql> show databases; +--------------------+
|
Database | +--------------------+
| Information_schema | | MySQL | | Performance_schema | |
SYS | +--------------------+ 4 rows in Set (0.00 sec) to see if the login is successful.
Remote with IP whether the successful landing mysql-u root-h192.168.1.69-p123456 mysql> show databases; +--------------------+
|
Database | +--------------------+
| Information_schema | | MySQL | | Performance_schema | |
SYS | +--------------------+ 4 rows in Set (0.00 sec) MySQL: [Warning] Using a password on the command line interface can I
Nsecure. Welcome to the MySQL Monitor. Commands End With;
or \g. Your MySQL Connection ID is 6 Server version:5.7.16 Source distribution Copyright (c), 2016, Oracle and/or its AFF Iliates.
All rights reserved. Oracle is a registered trademark to Oracle Corporation and/or its affiliates.
The other names may is trademarks of their respective owners. Type ' Help; ' or ' \h ' for help.
Type ' \c ' to clear the current input statement.
Mysql>
Test whether Nginx can open
[Root@qka169 html]# Ps-ef | grep php-fpm
Root 337433 1 0 18:03? 00:00:00 Php-fpm:master Process (/usr/local/php7/etc/php-fpm.conf)
Nobody 337434 337433 0 18:03? 00:00:00 Php-fpm:pool www
nobody 337435 337433 0 18:03? 00:00:00 php-fpm:pool www
root 337454 37888 0 18:12 pts/0 00:00:00 grep--color=auto php-fpm
[root@qka169 H tml]# Ps-ef | grep nginx
Root 337400 1 0 18:01? 00:00:00 nginx:master process/usr/sbin/nginx-c/etc/nginx/nginx.conf
nginx 337401 0 337400? 00:00:00 nginx:worker process
root 337456 37888 0 18:13 pts/0 00:00:00 grep--color=auto nginx
[root@qka1 html]# Netstat-nalp | grep
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 337400/nginx:maste
TCP 0 0 192.168.1.69:80 192.168.6.6:54714 time_wait-
tcp 0 0 192.168.1.69:80 192.168.6.6:54709 time_wait-
remote open
http://192.168.1.69/
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.