Nginx集群模块
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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集群模块的主要内容,如果未能解决你的问题,请参考以下文章
linux---集群架构初探(16)Nginx安装配置文件模块
如何使用模块化代码片段中的LeakCanary检测内存泄漏?
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段