简介:
Nginx(发音同 engine x)是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамблер)使用。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:新浪、网易、 腾讯等。
安装:
1.前期准备,下载最新的 Nginx 、OpenSSL、Pcre (nginx依赖其用作url rewrite)
本文这3个软件版本分别为
nginx-1.5.13.tar.gz
openssl-1.0.1g.tar.gz
pcre-8.35.tar.bz2
zlib-1.2.8.tar.gz
(见附件)
2.将3个软件至于你将要解压的目录,我使用的目录为
/home/soft
分别解压3个软件
tar -zxvf nginx-1.5.13.tar.gz tar -zxvf openssl-1.0.1g.tar.gz tar jxvf pcre-8.35.tar.bz2 tar -zxvf zlib-1.2.8.tar.gz
3.安装 pcre
cd pcre-8.35 ./configure --prefix=/usr/local/pcre make make install
4.安装openssl
cd ../openssl-1.0.1g ./config --prefix=/usr/local/openssl ./config -t make make install
5.安装nginx ,注意路径配置
cd ../nginx-1.5.13 ./configure --with-zlib=../zlib-1.2.8 --with-pcre=../pcre-8.35 --with-http_ssl_module --with-openssl=../openssl-1.0.1g make make install
6.检查是否安装成功
cd /usr/local/nginx/sbin
./nginx -t
结果显示:
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
测试配置文件是否正常
/usr/local/nginx/sbin/nginx -t -c ~/nginx.conf
至此,nginx 安装完成,稍后呈上nginx的配置例子及启动设置。