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…

     

如果这文章对你有帮助,请扫左上角微信支付-支付宝,给于打赏,以助博客运营

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注