Nginx安裝配置記錄

 

  1. 登錄LINUX系統:
  2. # yum install -y gcc gdb strace gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs patch e2fsprogs-devel krb5-devel libidn libidn-devel openldap-devel nss_ldap openldap-clients openldap-servers libevent-devel libevent uuid-devel uuid mysql-devel

 

 

三、

 


四、


 

 

五、


 

六、啟動nginx

啟動

#方法1

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

#方法2

# cd /usr/local/nginx/sbin

# ./nginx

七、關閉Nginx

停止

#查詢nginx主進程號

ps -ef | grep nginx

#停止進程

kill -QUIT 主進程號

#快速停止

kill -TERM 主進程號

#強制停止

pkill -9 nginx

 

 

八、安裝PHP

接下來我們開始安裝編譯PHP編譯前我們需要先安裝一些php需要用到的庫(用的是centos版本的linux系統)

yum -y install gcc automake autoconf libtool make

yum -y install gcc gcc-c++ glibc

yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel

 

安裝wget

yum -y install wget

 

獲取php

wget http://cn2.php.net/get/php-5.6.31.tar.gz/from/this/mirror

 

解壓並進入php目錄

    tar zvxf php-5.6.31.tar.gz

    cd php-5.6.31

編譯php

./configure –prefix=/usr/local/fastphp –enable-fpm –with-mcrypt –enable-mbstring –disable-pdo –with-curl –disable-debug –disable-rpath –enable-inline-optimization –with-bz2 –with-zlib –enable-sockets –enable-sysvsem –enable-sysvshm –enable-pcntl –enable-mbregex –with-mhash –enable-zip –with-pcre-regex –with-mysql –with-mysqli –with-gd –with-jpeg-dir

 

安裝php

make all install

 

修改Nginx.conf,將下面這段配置文明前面註解符取消掉

 

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

 

重啟nginx 和

/usr/local/nginx/sbin/nginx -s reload

啟動php-fpm

[root@localhost php-5.6.31]# find / -name php-fpm

/usr/local/fastphp/sbin/php-fpm

/set/php-5.6.31/sapi/fpm/php-fpm

[root@localhost php-5.6.31]# /usr/local/fastphp/sbin/php-fpm

查端口給那個服務進程給佔用

netstat -nap | grep LISTEN


殺掉端口佔用服務進程


重啟nginx和php-fpm


 


 

 

 

重啟Nginx和PHP-FPM

重啟php-fpm與nginx

# cd /usr/local/php5/sbin

# ./php-fpm restart

# cd /usr/local/nginx/sbin

# ./nginx -s reload

 

以下文章點擊率最高

Loading…

     

如果這文章對你有幫助,請掃左上角微信支付-支付寶,給於打賞,以助博客運營

發表評論

您的電子郵箱地址不會被公開。 必填項已用*標註