Centos7+php+nginx+mysql Installation

Source: Internet
Author: User

MySQL installation: 1, download mysql repo source wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm2, Installing the MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM package  rpm -ivh mysql-community-release-el7-5.noarch.rpm   NOTE: After installing this package, you will get two MySQL Yum repo sources:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/ MYSQL-COMMUNITY-SOURCE.REPO3, install mysql: yum install mysql-server 4, start service  systemctl  start mysqld php installation: Download:  http://php.net/downloads.php1, version download http://cn2.php.net/get/ Php-7.1.0.tar.gz/from/this/mirror2, unzip tar -zxvf php-7.1.0.tar.gz3, enter directory   cd php-7.1.04, Download the extension library yum install -y libxml2-devel php-mcrypt libmcrypt libmcrypt-devel  openssl openssl-devel libcurl libcurl-devel zlib zlib-devel libjpeg  LIBJPEG-DEVEL FREETYPE FREETYPE-DEVEL LIBPNG LIBPNG-DEVEL5, compile and install./configure --prefix=/ Usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-mcrypt=/usr/include --with-mysql --with-gd --with-iconv --with-zlib -- Enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization  --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf  --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip -- enable-soap --without-pear --with-gettext --enable-session --with-curl -- WITH-JPEG-DIR --WITH-FREETYPE-DIR --ENABLE-OPCACHEMAKEMAKE INSTALL6, Configuration:cp  Php.ini-development /usr/local/php7/lib/php.inicp /usr/local/php7/etc/php-fpm.conf.default /usr /local/php7/etc/php-fpm.confcp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/ PHP-FPM.D/WWW.CONF7, add service vim /etc/systemd/system/php-fpm.service[unit]description=the php  Fastcgi process managerafter=syslog.target network.target [service]type=simplepidfile=/run/php-fpm.pidexecstart=/usr/local/php7/sbin/php-fpm  --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.confexecreload=/bin/kill -usr2   $MAINPIDExecStop =/bin/kill -sigint  $MAINPID  [install]wantedby=multi-user.target8, Start Php-fpmsystemctl start php-fpm.service9, add to boot boot Systemctl enable php-fpm.service notes:  SYSTEMCTL directive systemctl enable *.service  #开机运行服务systemctl  disable *.service # Cancel boot run systemctl start *.service  #启动服务systemctl  stop *.service  #停止服务systemctl  restart *.service  #重启服务systemctl  reload *.service  #重新加载服务配置文件systemctl   status *.service  #查询服务运行状态systemctl  --failed  #显示启动失败的服务  nginx installation configuration: 1, download the installation package wget  HTTP://NGINX.ORG/DOWNLOAD/NGINX-1.10.1.TAR.GZ2, unzip tar -zvxf nginx-1.10.1.tar.gz3, enter directory   CD  nginx-1.10.14, compile and install./configure --prefix=/usr/local/nginx-1.10.1 --with-http_ssl_module --with-http_stub_status_modulemakemake  Install ln -s /usr/local/nginx-1.10.1/ /usr/local/nginx 5, adding a startup script vim /etc/init.d/ Nginx Copy Code #! /bin/bash## nginx - this script starts and stops the  nginx daemon## chkconfig:   - 85 15# description:   Nginx is an http (s)  server, http (s)  reverse #                proxy and IMAP/POP3 proxy  server## processname: nginx# config:      /etc/nginx/nginx.conf#  pidfile:     /var/run/nginx/nginx.pid # Source function  Library:  /etc/rc.d/init.d/functions # source networking configuration.  /etc/sysconfig/network #&nBsp Check that networking is up. [  "$NETWORKING"  =  "no"  ] && exit 0 nginx= "/usr/local/nginx/ Sbin/nginx "prog=$ (basename  $nginx)  nginx_conf_file="/usr/local/nginx/conf/nginx.conf " [ -f  /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/ Nginx.lock start ()  {    [ -x  $nginx  ] | |  exit 5    [ -f  $NGINX _conf_file ] | |  exit 6    echo -n $ "starting  $prog: "      daemon  $nginx  -c  $NGINX _conf_file    retval=$?     echo    [  $retval  -eq 0 ] && touch $ lockfile    return  $retval} stop ()  {    echo -n  $ "stopping  $prog:  "    killproc  $prog  -QUIT    retval=$?     echo    [  $retval  -eq 0 ] && rm -f   $lockfile     return  $retval} restart ()  {     configtest | |  return $?    stop    sleep 1     Start} reload ()  {    configtest | |  return $?    echo -n $ "reloading  $prog: "      killproc  $nginx  -hup    retval=$?    echo} force_ Reload ()  {    restart} configtest ()  {   $nginx  -t -c   $NGINX _conf_file} rh_status ()  {    status  $prog} rh_status_q ()  {    rh_status >/dev/null 2>&1} case  "$"  in    start)          rh_status_q && exit 0         $1        ;;     stop)         rh_status_q | |  exit 0        $1         ;;     restart|configtest)         $1         ;;     reload)         rh_status_q | |  exit 7        $1         ;;     force-reload)         force_reload         ;; &nBsp;   status)         rh_status         ;;     condrestart|try-restart)         rh_status_q  | |  exit 0            ;;     *)         echo $ "Usage: $0 { Start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest} "         exit 2esac


This article is from the "practice of Knowledge" blog, please be sure to keep this source http://m51cto.blog.51cto.com/53087/1959151

Centos7+php+nginx+mysql Installation

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.