码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx集群模块

时间:2017-06-27 17:33:39      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:pass   include   tomcat   default   file   share   配置   color   服务器   

ngx_http_upstream_module模块是定义一组服务器的,可以是proxy_passfastcgi_passuwsgi_passscgi_pass, 和 memcached_pass 指令。

下面写一个考试系统的集群Nginx+Tomcat

新建Nginx的配置文件

cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/exam_nginx.conf

编辑exam_nginx.conf,内容如下:

server {
    listen       80;
    server_name exam.windy.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        proxy_pass http://exam.windy.com;
    }

    #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   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apaches document root
    # concurs with nginxs one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
upstream exam.windy.com {
    server 192.168.52.130:8081;
    server 192.168.52.130:8080;
}

 

Nginx集群模块

标签:pass   include   tomcat   default   file   share   配置   color   服务器   

原文地址:http://www.cnblogs.com/windyWu/p/7086220.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!