ITeye博客

用nginx-0.8.32和一个tomcat6.0.20搭建ss3ex

san586 · 2010-01-15 14:14 · ss3ex · 企业架构 · Markdown

1、下载nginx-0.8.32和一个tomcat6.0.20 2、配置nginx.conf文件,下面是nginx.conf的完整内容:

user  www www;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen       80;
        server_name  localhost;

        charset utf-8;

        access_log  logs/host.access.log  main;

	location ~ ^/(images|scripts|js|css|flash|upload|style)/ {
	    root   你的WEB项目路径,如:d:/src/main/webapp;
	    access_log   off; 
            expires      30d;           
        }

 	location / {
            proxy_pass      http://localhost:8080;
        }

        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   错误页面的路径;
        }       
    }    
}

3、做负载均衡或者集群的话,也很简单,参照网站:http://wiki.nginx.org/Main

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。