一个关于nginx+keepalived的问题 页面被重置

发布于 2021-11-23 13:27:07 字数 4463 浏览 877 评论 1

我配置的keepalived+tengine(nginx),之前一直没有出现过这样的情况,但这次不知道为什么,它隔断时间提示这个东西,  刷新一下它又好了。。

keep的配置文件

! Configuration File for keepalived
global_defs {
   notification_email {
    admin@lvtao.net
        }
   notification_email_from admin@lvtao.net
   smtp_server 127.0.0.1
   smtp_connect_timeout 2
   router_id LVS_DEVEL
}
vrrp_script chk_nginx {
    script "/home/sh/check_nginx.sh"
    interval 2
    weight 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth2
    virtual_router_id 51
    mcast_src_ip 10.10.88.2
    priority 50
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass chtopnet
    }
    virtual_ipaddress {
        10.10.88.4
    }
    track_script {
        chk_nginx
    }

}
nginx的配置

user  www www;

worker_processes auto;
worker_cpu_affinity auto;

error_log  /home/wwwlogs/nginx_error.log  crit;

pid  /home/webserver/nginx/logs/nginx.pid;
google_perftools_profiles    /tmp/tcmalloc;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events {
	use epoll;
	#worker_connections  1024;
	worker_connections 51200;
}

http {
	include       mime.types;
	default_type  application/octet-stream;

	#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;

	server_names_hash_bucket_size 128;
	client_header_buffer_size 128k;
	large_client_header_buffers 4 128k;
	client_max_body_size 50m;

	sendfile on;
	#tcp_nopush on;

	#keepalive_timeout  0;
	keepalive_timeout  65;
	#gzip  on;

	tcp_nodelay on;
	server_tokens off;

	fastcgi_connect_timeout 300;
	fastcgi_send_timeout 300;
	fastcgi_read_timeout 300;
	fastcgi_buffer_size 64k;
	fastcgi_buffers 4 64k;
	fastcgi_busy_buffers_size 128k;
	fastcgi_temp_file_write_size 256k;

	gzip on;
	gzip_min_length  1k;
	gzip_buffers     4 16k;
	gzip_http_version 1.0;
	gzip_comp_level 2;
	gzip_types       text/plain application/x-javascript text/css application/xml;
	gzip_vary on;

	server {
		listen       80;
		server_name localhost;
		#charset koi8-r;
		index index.html index.htm index.php;
		root  /home/wwwroot;
		location / {
			#禁止外网访问
			allow 192.168.0.0/16;
			allow 10.10.0.0/16;
			deny all;
		}

		#error_page  404  /404.html;

		# redirect server error pages to the static page /50x.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;
		#}

		location ~ .*.(php|php5)?$
		{
			fastcgi_pass  unix:/tmp/php-cgi.sock;
			fastcgi_index index.php;
			include fcgi.conf;
		}

		location /status {
			stub_status on;
			access_log   off;
		}

		location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
		{
			expires      30d;
		}

		location ~ .*.(js|css)?$
		{
			expires      12h;
		}
		#access_log  /home/wwwlogs/host.access.log  main;
	}

	# 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;
	#    }
	#}

	include vhost/*.conf;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文