Nginx/Lighttpd反向代理服务器安装

阅读更多
减小字体 增大字体 作者:99uc.net  来源:本站整理  发布时间:2009-11-20 22:41:17反向代理服务已经越来越广泛的应用于高负载的Web站点中,常用来作为Reverse
Proxy的有Squid、Apache、Lighttpd、Nginx等,后两个轻量级的应用因为其优秀的表现已迅速占领了大量市场,本文只讨论后两者的简单应用(用proxy处理静态文件而把动态文件交给后端的Web服务器来处理)

安装环境
操作系统: Debian 4.0 r3
Kernel:
2.6.18-6-686

软件列表
nginx-0.6.31.tar.gz
lighttpd-1.4.19.tar.gz

安装过程
安装nginx作为反向代理
#
tar zxvf nginx-0.6.31.tar.gz
# cd nginx-0.6.31
# ./configure
–prefix=/usr/local/nginx –with-http_realip_module
# make && make
install
# vi /usr/local/nginx/conf/nginx.conf

        location /
{
            proxy_pass         http://10.10.10.87/;
           
proxy_redirect     off;

            proxy_set_header   Host            
$host;
            proxy_set_header   X-Real-IP       
$remote_addr;
#            proxy_set_header   X-Forwarded-For 
$proxy_add_x_forwarded_for;;

            client_max_body_size      
10m;
            client_body_buffer_size    128k;

           
proxy_connect_timeout      90;
            proxy_send_timeout        
90;
            proxy_read_timeout         90;

           
proxy_buffer_size          4k;
            proxy_buffers              4
32k;
            proxy_busy_buffers_size    64k;
           
proxy_temp_file_write_size 64k;
        }

        # Static files
location
        location ~*
^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|htm|html)$
{
            root   /srv/www/htdocs/;
        }

启动nginx
#
/usr/local/nginx/sbin/nginx

安装lighttpd作为反向代理
# tar zxvf
lighttpd-1.4.19.tar.gz
# cd lighttpd-1.4.19
# ./configure
–prefix=/usr/loca/lighttpd –without-bzip2
# make && make
install
# cp doc/lighttpd.conf /etc/lighttpd.conf
# vi
/etc/lighttpd.conf

server.modules              =
(
                               
“mod_access”,
                               
“mod_status”,
                               
“mod_proxy”,
                                “mod_accesslog”
)

server.document-root        =
“/srv/www/htdocs/”

server.errorlog             =
“/var/log/lighttpd/error.log”

status.status-url =
“/server-status”

$HTTP["url"] !~
“\.(js|css|gif|jpg|png|ico|txt|swf|html|htm)$” {
     proxy.server  = ( “”
=> (
     ( “host” => “10.10.10.87″, “port” => 80 )
     
)
    )
}

启动lighttpd
# /usr/local/lighttpd/sbin/lighttpd -f
/etc/lighttpd.conf

参考文档
http://www.mysqlperformanceblog.com/2008/06/17/lighttpd-as-reverse-proxy/
http://blog.kovyrin.net/2006/05/18/nginx-as-reverse-proxy/
http://www.mysqlperformanceblog.com/2006/05/21/speedup-your-lamp-stack-with-lighttpd/

http://blog.kovyrin.net/2006/04/17/typical-nginx-configurations/

你可能感兴趣的:(lighttpd,nginx)