配置NGINX和TOMCAT负载均衡

添加用户

useradd -s /bin/false www-data

配置NGINX

user  www-data;
http {
    upstream balancer {
        server localhost:8080;
    }

    location / {
        # try_files $uri $uri/ =404;
        index index.html index.jsp
        proxy_connect_timeout 3;
        proxy_send_timeout 30;
        proxy_read_timeout 30;
        proxy_pass http://balancer;
    }
    location ^~ /upload/ {
        root /usr/share/tomcat/webapps;
        expires 30d;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|otf|eot|svg|ttf|woff)$ {
        root /usr/share/tomcat/webapps;
        expires 30d;
    }
}

标签: none

添加新评论

www.000webhost.com