Skip to content
shine0565 edited this page Sep 21, 2018 · 7 revisions

说明

假设我们有两台静态服务器,10.10.10.1,10.10.10.2,一套k8s集群,loadbalance暴露地址10.10.20.1:8080,一台nginx,10.10.10.10。

Dolores配置

module.exports = { serve: 'http://10.10.10.10:38080', keys: ['some secret hurr'], session: { key: 'koa:sess' } }

##Nginx

` user root; worker_processes 4; events { worker_connections 1024; }

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

	sendfile on;
	keepalive_timeout 65;
	client_max_body_size 30m;

	upstream front {
		server	10.10.10.1:80;
		server	10.10.10.2:80;
	}

	server {
		listen	80;
		server_name	localhost;

		location ~ /nginx_status {
			stub_status on;
			access_log on;
		}

		#access_log logs/host.access.log main

		location / {
			# 404
			proxy_intercept_error on;
			proxy_pass http://front;
			proxy_set_header	Host	$host
			proxy_set_header	X-Real-IP	$remote_addr;
			root	/var/www/html;
			# 404
			try_files	$uri	$uri	@router;
			index	index.html	index.htm;
		}

                    #404
		location	@router {
			rewrite ^.*$	/index.html	last;
		}
	}

	server {
		listen	38080;
		server_name localhost;

		location / {
			proxy_set_header	X-Real-IP	$remote_addr;
			proxy_set_header	X-Forwarded-For	$proxy_add_x_forwarded_for;
			proxy_set_header	Host 	$http_host;
			proxy_set_header	X-Nginx-Proxy	true;
			proxy_set_header	Connection 	"";
			proxy_pass	http://10.10.20.1:8080/;
		}
	}
}`
Clone this wiki locally