Nginx (“engine x”) 是俄罗斯人Igor Sysoev(塞索耶夫)编写的一款高性能的 HTTP 和反向代理服务器。Nginx 已经在俄罗斯最大的门户网站── Rambler Media(
[url]www.rambler.ru[/url])上运行了3年时间,同时俄罗斯超过20%的虚拟主机平台采用Nginx作为反向代理服务器。
在国内,已经有 新浪博客、新浪播客、网易新闻、六间房、56.com、Discuz!、水木社区、豆瓣、YUPOO、海内、迅雷在线 等多家网站使用 Nginx 作为Web服务器或反向代理服务器。
在国内,已经有 新浪博客、新浪播客、网易新闻、六间房、56.com、Discuz!、水木社区、豆瓣、YUPOO、海内、迅雷在线 等多家网站使用 Nginx 作为Web服务器或反向代理服务器。
下面开始在debian 下部署nginx
首先不需要太多包,只需要 pcre, ssl and zlib
aptitude install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
现在,我们可以下载源代码了。如下
cd /home
tar -zxvf nginx-0.7.30.tar.gz
cd nginx-0.7.30
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module --with-http_stub_status_module
最后会显示
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5 library is not used
+ sha1 library is not used
+ using system zlib library
+ using system PCRE library
+ using system OpenSSL library
+ md5 library is not used
+ sha1 library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin"
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: "/usr/local/nginx/client_body_temp"
nginx http proxy temporary files: "/usr/local/nginx/proxy_temp"
nginx http fastcgi temporary files: "/usr/local/nginx/fastcgi_temp"
nginx binary file: "/usr/local/sbin"
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: "/usr/local/nginx/client_body_temp"
nginx http proxy temporary files: "/usr/local/nginx/proxy_temp"
nginx http fastcgi temporary files: "/usr/local/nginx/fastcgi_temp"
继续
make&&make install
现在来创建一个启动脚本
nano /etc/init.d/nginx 然后插入以下脚本
继续
添加脚本到系统默认运行级别
/usr/sbin/update-rc.d -f nginx defaults
由于nginx是安装在/usr/local/,可以链接到我们常用的/etc/下
ln -s /usr/local/nginx /etc/nginx
现在可以运行nginx了
/etc/init.d/nginx start
继续
lynx
[url]http://localhost[/url]或者用局域网其它机器访问本机
如果出现
Welcome to nginx!
说明nginx安装成功了。
转载于:https://blog.51cto.com/67054/128245