1. Installation of Nginx Yum
1) Add Nginx to Yum source
Add the CentOS 7 Nginx Yum Repository, open the terminal and use the following command:
sudo rpm-uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2) Install Nginx
Use the yum
commands from the Nginx source server to install Nginx in your CentOS 7 server:
sudo yum install -y nginx
3) Start Nginx
Nginx-c/etc/nginx/nginx.conf Open Nginx
Nginx-s Reload Modify configuration after reload takes effect
Nginx-s reopen: Reopen log file
NGINX-T-c/path/to/nginx.conf Test nginx configuration file is correct
Nginx-s stop: Fast Stop Nginx
4) Nginx set-up self-booting
sudo systemctl enable nginx.service
5) directory where Nginx configuration files are located
/etc/nginx/conf.d/
2. PHP7 Compile and install
1) cd/usr/local/src/
2) wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
3) TAR-XZXVF php-7.0.2.tar.gz
4) CD php-7.0.2
5) do not compile after extracting, please check if GCC is installed, do not execute yum install gcc
6) Check if LIBXML2&NBSP is installed, do not run yum install libxml2 7) to check if Libxml2-devel is installed, do not execute yum install Libxml2-devel Note: Because it is replaced with Nginx , so the compilation parameters in the--with-apxs2=/usr/bin/apxs removed, if you want to configure Apache, before installing PHP, please install Apache first. 8) Compile parameter configuration './configure '--prefix=/usr/local/php '--with-pdo-pgsql '--with-zlib-dir '--with-freetype-dir ' --enable-mbstring '--with-libxml-dir=/usr '--enable-soap '--enable-calendar '--with-curl '--with-mcrypt '-- With-gd '--with-pgsql '--disable-rpath '--enable-inline-optimization '--with-bz2 '--with-zlib '-- Enable-sockets '--enable-sysvsem '--enable-sysvshm '--enable-pcntl '--enable-mbregex '--enable-exif '-- Enable-bcmath '--with-mhash '--enable-zip '--with-pcre-regex '--with-pdo-mysql '--with-mysqli '--with-jpeg-dir =/usr '--with-png-dir=/usr '--enable-gd-native-ttf '--with-openssl '--with-fpm-user=www-data '--with-fpm-group =www-data '--with-libdir=/lib/x86_64-linux-gnu/'--enable-ftp '--with-gettext '--with-xmlrpc '--with-xsl '-- Enable-opcache ' '--enable-fpm '--with-iconv '--with-xpm-dir=/usr ' 9) Error cannot find OpenSSL ' s <evp.h> Execute yum install OpenSSL openssl-devel 10) Error please Reinstall the Libcurl distribution &NB Sp Execute yum-y Install curl-devel 11) Error jpeglib.h not found execute yum Install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64-y and execute yum install libjpeg-devel ) checking for BZIP2 in default path ... not found & Nbsp;configure:error:please Reinstall the BZIP2 distribution This is the BZIP2 package does not install the workaround yum install Bzip2-de vel.x86_64-y ) configure:error:xpm.h not found. yum install libxpm-devel ) error:unable to locate Gmp.h fix:yum in Stall gmp-devel 15) Phenomenon: Unable to detect ICU prefix Or/usr//bin/icu-config failed. Please veRify ICU install prefix and make sure Icu-config works workaround: Yum install-y ICU libic U libicu-devel 16) Error: Mcrypt.h not found. Please reinstall Libmcrypt. Solutions:yum install php-mcrypt libmcrypt libmcrypt-devel 17) Error: Configure:error:Cannot find Libpq-fe.h. Please specify correct PostgreSQL installation path WORKAROUND: Yum install postgresql-devel 18) Error: &NB Sp;configure:error:xslt-config not found. Please reinstall the LIBXSLT >= 1.1.0 distribution FIX: yum install libxslt-devel 19) configured Checkin After G, execute: make clean && make && make install (If an error occurs:--enable-opcache=no Execute export ld_library _path=/usr/local/mysql/lib or export Ld_library_path=/lib/:/usr/lib/:/usr/local/lib) 20) After the installation is complete, We want to copy the configuration files in the source package to the PHP installation directory, the source package has two configuration php.ini-development php.ini-production look at the name to know that one is the development environment , one is the production environment, we are here to replicate the development environmentCP php.ini-development/usr/local/php/lib/php.ini 21) It is also necessary to set the environment variable: Modify the Vim/etc/profile file to make it permanent and take effect for all system users. Add the following two lines of code to the end of the file path= $PATH:/usr/local/php/bin export PATH and Execute command source/etc/profile ) PHP-V can see the ph P version information. 23) also need to configure php-fpm:cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf CP at this time /usr/local/php/etc/php-fpm.d/www.conf.default/usr/local/php/etc/php-fpm.d/www.conf cp/usr/local/src/ php-7.0.2/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm chmod +x/etc/init.d/php-fpm 24) Start php-fpm: /usr/lo CAL/PHP/SBIN/PHP-FPM3, MySQL yum installation 1) download MySQL source wget Http://dev. mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
2) Install MySQL source sudo rpm-ivh mysql57-community-release-el7-7.noarch.rpm
3) Install mysql-community-server sudo yum install mysql-community-server-y
4) Restart MySQL systemctl restart mysqld Note: auto-start service with Systemctl enable MySQL
Nginx+php7+mysql installation under centos7.3