Nginx的官方下载地址http://nginx.org
进入目录
[iyunv@LnmpLinux ~]# cd /usr/local/src
下载Nginx
[iyunv@LnmpLinux src]# wget http://nginx.org/download/nginx-1.6.3.tar.gz
解压Nginx
[iyunv@LnmpLinux src]# tar zxvf nginx-1.6.3.tar.gz
编译安装
[iyunv@LnmpLinux src]# cd nginx-1.6.3
[iyunv@LnmpLinux nginx-1.6.3]# ./configure --prefix=/usr/local/nginx --with-pcre
编译过程中出现的问题:
./configure: error: the HTTP rewrite module requires the PCRE library.
解决方法
[iyunv@LnmpLinux nginx-1.6.3]# yum list |grep pcre
[iyunv@LnmpLinux nginx-1.6.3]# yum install -y pcre-devel
重新编译安装
[iyunv@LnmpLinux nginx-1.6.3]# echo $?
0
[iyunv@LnmpLinux nginx-1.6.3]# make && make install
[iyunv@LnmpLinux nginx-1.6.3]# echo $? 0 启动
[iyunv@LnmpLinux nginx-1.6.3]# /usr/local/nginx/sbin/nginx
查看进程
[iyunv@LnmpLinux nginx-1.6.3]# ps aux |grep nginx
监听端口
[iyunv@LnmpLinux nginx-1.6.3]# netstat -lnp |grep nginx
补充:
Nginx并没有自己的启动脚本,我们可以手动去写一个Nginx启动脚本,前提我们需要先解析php,我们知道Nginx和PHP在配置之前是不能联系到一起的,需要去手动更改配置文件,让两者产生联系,能正常执行PHP,解析PHP网站。
|