nginx 安装记录

gcc

安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc

yum install gcc-c++


PCRE

PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginxhttp模块使用pcre来解析正则表达式,所以需要在linux上安装pcre库。

注:pcre-devel是使用pcre开发的一个二次开发库。nginx也需要此库。

yum install -y pcre pcre-devel


zlib

zlib库提供了很多种压缩和解压缩的方式,nginx使用zlibhttp包的内容进行gzip,所以需要在linux上安装zlib库。

yum install -y zlib zlib-devel

 

openssl

OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。

nginx不仅支持http协议,还支持https(即在ssl协议上传输http),所以需要在linux安装openssl库。

yum install -y openssl openssl-devel


下载tengine包

wget  http://tengine.taobao.org/download/tengine.tar.gz

tar zvxf tengine.tar.gz

./configure --prefix=/opt/nginx (安装到/opt/nginx 目录下)

make && make install


cd /opt/nginx

./sbin/nginx -t (检测配置文件)

如果显示下面信息,即表示配置没问题

nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful

[root@centos ~]# ./sbin/nginx 

[root@centos ~]# ps au|grep nginx

如果显以类似下面的信息,即表示nginx已经启动

root 2013 0.0 0.0 103156 856 pts/0 S+ 03:22 0:00 grep nginx


详情请看 :http://blog.csdn.net/qq_15766181/article/details/51959921








































發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章