天天看點

yum 6.8 nginx php-fpm

centos6.8 yum安裝 php-fpm

1.檢查目前安裝的PHP包

yum list installed | grep php

如果有安裝的PHP包,先删除他們

  1. yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64  

配置yum源

追加CentOS 6.5的epel及remi源。

?

# rpm -Uvh http:

//ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-

release-6-8.noarch.rpm

# rpm -Uvh http:

//rpms.famillecollet.com/enterprise/remi-release-6.rpm

http://my.oschina.net/u/573270/blog/423238#

以下是CentOS 7.0的源。

# yum install epel-release

# rpm -ivh http:

//rpms.famillecollet.com/enterprise/remi-release-7.rpm

http://my.oschina.net/u/573270/blog/423238#

使用yum list指令檢視可安裝的包(Packege)。

?# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php

安裝PHP5.6.x

yum源配置好了,下一步就安裝PHP5.6。

# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache 

php-devel php-mbstring php-mcrypt php-mysqlnd 

php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof

PHP

指令檢視版本。

# php --version

PHP 5.6.0 (cli) (built: Sep  3 2014 19:51:31)

Copyright (c) 1997-2014 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derck Rethans

安裝PHP-fpm

yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm 

centos6.8 安裝nginx

準備條件

yum install -y gcc-c++

yum install -y pcre pcre-devel

yum install -y zlib zlib-devel

yum install -y openssl openssl-devel

安裝

wget  https://nginx.org/download/nginx-1.8.0.tar.gz

tar zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module

--with-pcre

make && make install

檢視服務路徑

find/  -name  nginx

進入nginx安裝路徑:cd /usr/local/nginx/sbin

啟動服務

啟動:

1. ./nginx

2. /usr/local/nginx/sbin/nginx

-c /usr/local/nginx/conf/nginx.conf

兩種方式都可以

4. 停止:

從容停止:kill -QUIT 19795(注意:19795是Nginx的程序号)

快速停止:kill -TERM 46968(注意:46968是Nginx的程序号)

(強制停止:pkill -9 nginx

./nginx -s stop:此方式相當于先查出nginx程序id再使用kill指令強制殺掉程序。

./nginx -s quit:此方式停止步驟是待nginx程序處理任務完畢進行停止。 

先停止再啟動:./nginx -s quit; ./nginx)

.驗證nginx的配置檔案是否正确:

1. cd /usr/local/nginx/sbin 進入nginx的安裝目錄,接着執行 ./nginx -t

重新加載配置檔案:

./nginx -s reload

檢視nginx程序:

1. ps -ef |grep nginx

2.ps aux|grep nginx