操作系统:Linux Cent OS 5 / Max OS X 10.6 snow leopard
安装版本:Nginx 0.8.43
Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,由俄罗斯人Igor Sysoev开发,它主要优势在于资源占用情况比apache强了太多,高并发情况下对内存的占用也很少,现在也被很多大型网站还是采用,下面记录一下安装配置过程:
-
下载:请到官方网站http://nginx.org/或者直接点击链接http://nginx.org/download/nginx-0.8.43.tar.gz
-
解压:tar jxvf nginx-*
-
进入文件目录,运行以下命令:
1)./configure
2)make
3)sudo make install
命令1为安装程序自动配置环境,命令2为编译源程序,命令3为安装
-
完成后 Nginx基本就安装好了,默认安装在/usr/local/nginx,可以在.configure --prefix=设置安装目录中。
注(mac):这个是隐藏目录,Finder中是直接看不到的,要在Finder中点击前往-前往文件夹,然后输入/usr才能进入。
-
输入以下命令启动Nginx,然后浏览器输入地址http://localhost进行测试,看到很大的字体的Welcome to nginx!就代表安装成功了
/usr/local/nginx/sbin/nginx
注:默认./configure后的配置结果为:
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1 library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
如有问题请留言,我一定尽力解答,Good Luck!
可能碰到的问题:
-
./configure: error: the HTTP rewrite module requires the PCRE library.
解释:http rewrite模块需要PCRE资源库支持
解决:安装pcre-devel
yum install pcre-devel
-
./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.
解释:http缓存模块需要OpenSSL资源库内的md5方法支持
解决:安装openssl openssl-devel
yum install openssl openssl-devel
查看全文