centos7+php+nginx+mysql安裝

來源:互聯網
上載者:User

標籤:mysql   nginx   php   

mysql安裝:1、下載mysql的repo源wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm2、安裝mysql-community-release-el7-5.noarch.rpm包 rpm -ivh mysql-community-release-el7-5.noarch.rpm 備忘:安裝這個包後,會獲得兩個mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo3、安裝mysql: yum install mysql-server 4、啟動服務 systemctl start mysqld php安裝:官網下載: http://php.net/downloads.php1、版本下載http://cn2.php.net/get/php-7.1.0.tar.gz/from/this/mirror2、解壓tar -zxvf php-7.1.0.tar.gz3、進入目錄  cd php-7.1.04、下載擴充庫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、編譯安裝./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、配置: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、添加服務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、啟動php-fpmsystemctl start php-fpm.service9、添加到開機啟動systemctl enable php-fpm.service備忘: systemctl指令systemctl enable *.service #開機運行服務systemctl disable *.service #取消開機運行systemctl start *.service #啟動服務systemctl stop *.service #停止服務systemctl restart *.service #重啟服務systemctl reload *.service #重新載入服務組態檔systemctl status *.service #查詢服務運行狀態systemctl --failed #顯示啟動失敗的服務 nginx安裝配置:1、下載安裝包wget http://nginx.org/download/nginx-1.10.1.tar.gz2、解壓tar -zvxf nginx-1.10.1.tar.gz3、進入目錄  cd nginx-1.10.14、編譯安裝./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、添加啟動指令碼vim /etc/init.d/nginx複製代碼#! /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 # 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 "$1" 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        ;;    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


本文出自 “實踐出真知” 部落格,請務必保留此出處http://m51cto.blog.51cto.com/53087/1959151

centos7+php+nginx+mysql安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.