Centos65 下安装nginx128

原创
2016-08-08 09:21:55 684浏览

1.选定源码目录
选定目录 /usr/local/

cd /usr/local/

2.安装PCRE库(准备安装包pcre-8.36.zip到local目录下)
cd /usr/local/
zip pcre-8.36.zip
cd pcre-8.36
./configure (编译)
make (预安装)
make install (正式安装)

3.安装zlib库
cd /usr/local/
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8
./configure
make
make install
4.安装ssl(有的vps默认没装ssl)

cd /usr/local/
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz
cd openssl-1.0.1c
./config
make

make install


5.安装nginx

Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:

cd /usr/local/
wget http://nginx.org/download/nginx-1.2.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
./configure --prefix=/usr/local/nginx --user=www --group=www --with-pcre=/usr/local/pcre-8.36 --with-zlib=/usr/local/zlib-1.2.8 --with-openssl=/usr/local/openssl-1.0.1c --with-http_ssl_module --with-http_stub_status_module(上面面为了展示需要写在多行,执行时内容需要在同一行)
make
make install

--with-pcre=/usr/local/pcre-8.36 (指的是pcre-8.21 的源码路径。)

--with-zlib=/usr/local/zlib-1.2.8 (指的是zlib-1.2.8 的源码路径。).....

安装成功后 /usr/local/nginx/conf 目录下如下
----------------------------------------------------------------------

端口
启动确保系统的 80 端口没被其他程序占用

#netstat -ano|grep 80
如果查不到结果后执行,有结果则忽略此步骤

启动

/usr/local/nginx/sbin/nginx 启动 Nginx

打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。

运行结果如下:

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了Centos65 下安装nginx128,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。