首页 > 代码库 > Nginx集群模块
Nginx集群模块
ngx_http_upstream_module模块是定义一组服务器的,可以是proxy_pass, fastcgi_pass, uwsgi_pass, scgi_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 Apache‘s document root # concurs with nginx‘s one # #location ~ /\.ht { # deny all; #} } upstream exam.windy.com { server 192.168.52.130:8081; server 192.168.52.130:8080; }
Nginx集群模块
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。