有关于window下nginx+resin的集群配置
服务器的操作系统为window 2003 我要在这上配置 resin+nginx的集群,我配置好后,可以访问但是过几分钟后nginx就无法访问的,直接输入域名无法访问,但是域名加上resin的8080端口 就可以访问,我觉得是nginx的问题
#user www www;
worker_processes 2; #这个安装你服务器cpu数量设置
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 65536;#这个为最大文件数可以输入命令查看ulimit –n linux默认打开数量为1000
}
http {
include mime.types;
default_type application/octet-stream;
include proxy.conf; #一定要指向代理文件
#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;
#这个为你toncat服务器的地址下面介绍tomcat集群配置,weight为全重全重越高被分配的几率越大
upstream testservers {
server 211.100.98.38:8080 weight=1 max_fails=2 fail_timeout=30s;
#server 211.100.98.16:8081 weight=1 max_fails=2 fail_timeout=30s;
}
server {
listen 80;
server_name test1.37zone.com test2.37zone.com;
index index.html index.htm index.jsp login.jsp;
#charset UTF-8;
#access_log logs/host.access.log main;
location / {
proxy_pass http://testservers; #这里的参数要和上面upstream 后面的testservers保持一致
proxy_redirect default;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Range $http_range;
proxy_next_upstream http_502 http_504 error timeout invalid_header;
}
# location ~ .*.jsp$ { #匹配以jsp结尾的,tomcat的网页文件是以jsp结尾
# index index.jsp;
# proxy_pass http://127.0.0.1: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 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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
以上是我的nginx的配置。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
用的是 nginx1.2.0 不过已经解决了我用了 1.2.1 不过配置上改了一下
楼主用的是Nginx的哪个版本啊