覺得 pound + lighttpd 太麻煩嗎?又翻到一個應該不錯的選擇,
是一個俄國人寫的 http server, 也具有 reverse proxy 和
load balancing 的能力。
godfat ~ 3.2$ port info nginx
nginx 0.5.29, www/nginx (Variants: universal, dav, flv, mail, ssl)
http://nginx.net/
Nginx ("engine x") is a high-performance HTTP(S) server and reverse proxy,
as well as an IMAP/POP3 proxy server. Nginx was written by Igor Sysoev for
Rambler.ru, Russia's second-most visited website, where it has been running
in production for over two and a half years. Igor has released the source
code under a BSD-like license. Although still in beta, Nginx is known for
its stability, rich feature set, simple configuration, and low resource
consumption.
這個字實在是很難記…不過討論翻來翻去,他 serve static file 的效能和
lighttpd 在伯仲之間,而 load balancing 是正常可用的。所以與其使用
pound + lighttpd, 單用 nginx 可以簡化一些流程。我想缺點就是設定上
還是比 pound 複雜些,不過我個人是覺得比 lighttpd 簡單了。另外 nginx
好像沒有 windows 版,而 pound 和 lighttpd 都有 windows 版,
我想這對某些情況可能也是個考量吧?
雖然之前因為英文文件太少所以不太流行,但最近似乎還算有蠻多人推薦的,
而且這在俄國好像還蠻廣泛被使用的,試試應該無妨。
sudo yum install nginx
跟 lighttpd 一樣,一起丟到 beast 目錄下比較容易管理。
cp /etc/nginx/nginx.conf \
/home/YOUR_NAME/projects/beast/stable-1.0/config/nginx.conf
cp /etc/nginx/mime.types \
/home/YOUR_NAME/projects/beast/stable-1.0/config/mime.types
前者是 config 檔,後者是 mime-type 設定檔,會被 include 進去。
nano config/nginx.conf
=======================
user YOUR_NAME YOUR_NAME;
worker_processes 1;
pid /home/YOUR_NAME/projects/beast/stable-1.0/tmp/pids/nginx.pid;
error_log /home/YOUR_NAME/projects/beast/stable-1.0/log/nginx_error.log;
events {
worker_connections 1024;
}
http {
include /home/YOUR_NAME/projects/beast/stable-1.0/config/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /home/YOUR_NAME/projects/beast/stable-1.0/log/nginx_access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain text/html text/xhtml text/css text/javascript;
upstream mongrel {
server 127.0.0.1:2000;
server 127.0.0.1:2001;
server 127.0.0.1:2002;
}
server {
listen 80;
server_name localhost;
location ~ ^/(images|javascripts|stylesheets)/ {
root /home/YOUR_NAME/projects/beast/stable-1.0/public
expires 30d;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://mongrel;
}
}
}
=======================
其實還有一大堆設定我省略掉了,可以自己上官網或 google 找其他的設定。
啟動:
sudo nginx -c config/nginx.conf
關閉:
sudo kill `cat tmp/pids/nginx.pid`
我用這個去跑 YSlow, 應該是設定的關係,分數從 62 => 75...
但當然以我測試機的超低流量來看,就算直接用 mongrel 應該也是瞬間反應…
分享到:
相关推荐
Fedora Core 6 Linux安装配置详细介绍
fedoracore linux6安装图解
红帽子Linux Fedora Core 6安装全程图解.rar 红帽子Linux Fedora Core 6安装全程图解.rar 红帽子Linux Fedora Core 6安装全程图解.rar
Fedora Core 6 安装 部署说明文档
硬盘安装Fedora 的详细过程,是我自己写的,大家凑和看吧~
在VMware上安装Fedora Core 9步骤详解
Fedora Core9的硬盘安装攻略,对想学习linux的同志有所帮助.
在Fedora core linux中安装VMware Workstaton虚拟机.pdf
Fedora Core 5.0 安装图文版Fedora Core 5.0 安装图文版
一、硬盘安装 二、几点感受 三、ADSL上网设置 四、关闭不需要的服务进程 五、让终端的字体更清晰些 六、挂载Win分区 七、寻找可执行文件 八、让“添加/删除软件”不再是摆设 九、让KDE显示中文菜单 十、...
fedora一些安装说明fedora一些安装说明fedora一些安装说明fedora一些安装说明
fedora+7+安装图解 fedora+7+安装图解 fedora+7+安装图解
挺详细的FC6安装教程!
Linux作为在服务器行业使用最多的操作系统,是我们学习网络的人必须学会的。而在虚拟机上安装 linux,不仅安全,而且可以和我们的原来系统建立网络连接。...Fedora Core 6的5张安装盘(建议使用ISO文件)
详细介绍Fedora Core 9 的系统安装全过程,并带有清晰图片分布介绍,令学者一目了然。
Fedora Core 5 新手指南 本指南由Latvia大学Linux中心和热心帮助的人们维护,文章内容遵守 GNU Free Documentation License 1.2. 本文是Fedora Core 5的上手指南,与Fedora项目和Redhat公司没有联系。
Fedora Core 5.0 安装教程,学习必备
Fedora 7图解安装教程 Fedora 7图解安装教程 Fedora 7图解安装教程 Fedora 7图解安装教程