下载安装所需包
openssl-1.0.1i.tar.gz
zlib-1.2.8.tar.gz
pcre-8.35.tar.gz
nginx-1.7.4.tar.gz
以上为nginx依赖文件
libmcrypt-2.5.7.tar.gz
php-5.3.28.tar.gz
以上为php依赖文件
依次安装
1.安装openssl-1.0.1i.tar.gz
[[email protected] mrms]# tar -zxvf openssl-1.0.1i.tar.gz [[email protected] mrms]# cd openssl-1.0.1i.tar.gz [[email protected] openssl-1.0.1i.tar.gz]# ./config [[email protected] openssl-1.0.1i.tar.gz]# make && make install
2.安装zlib-1.2.8.tar.gz
[[email protected] mrms]# tar -zxvf zlib-1.2.8.tar.gz [[email protected] mrms]# cd zlib-1.2.8 [[email protected] zlib-1.2.8]# ./configure [[email protected] zlib-1.2.8]# make && make install
3.安装pcre-8.35.tar.gz
[[email protected] mrms]# tar -zxvf pcre-8.35.tar.gz [[email protected] mrms]# cd pcre-8.35 [[email protected] pcre-8.35]# ./configure [[email protected] pcre-8.35]# make && make install
4.安装 nginx-1.7.4.tar.gz
[[email protected] mrms]# tar -zxvf nginx-1.7.4.tar.gz [[email protected] mrms]# cd nginx-1.7.4 [[email protected] nginx-1.7.4]# ./configure --with-pcre=../pcre-8.35 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-1.0.1i [[email protected] nginx-1.7.4]# make && make install
至此Nginx的安装完成!
第三步:检测是否安装成功
[[email protected] nginx-1.2.6]# cd /usr/local/nginx/sbin [[email protected] sbin]# ./nginx -t
出现如下所示提示,表示安装成功
启动nginx
[[email protected] sbin]# ./nginx
查看端口
[[email protected] sbin]# netstat -ntlp
结果如下
接着安装libmcrypt-2.5.7.tar.gz, 这个文件是安装php所需
注意:configure: error: mcrypt.h not found. Please reinstall libmcrypt.此错误由libmcrypt引起
[[email protected] mrms]# tar -zxvf libmcrypt-2.5.7.tar.gz [[email protected] mrms]# cd libmcrypt-2.5.7 [[email protected] libmcrypt-2.5.7]# ./configure [[email protected] libmcrypt-2.5.7]# make && make install
最后安装php
[[email protected] mrms]# tar -zxvf php-5.3.28.tar.gz [[email protected] mrms]# cd php-5.3.28 [[email protected] php-5.3.28]#./configure --prefix=/home/opt/php --with-config-file-path=/home/opt/php/etc --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-mbstring --with-mcrypt --with-mhash --enable-fpm --with-gd --enable-gd-native-ttf --with-curl --with-openssl [[email protected] php-5.3.28]# make && make install
到此php就安装成功了,然后启动php-fpm就可以了。
接下去就是配置nginx访问目录了,如出现php文件无法运行可以检查下fastcgi_param文件,我这里出现过一种这个情况,然后我在里面添加了fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;就OK了。
时间: 2024-10-06 07:25:21