利用CDN让无法备案的域名使用国内服务器

搬瓦工云服务器要到期了,速度太慢,不再续费咯

本博客原先是基于国外搬瓦工服务器进行反向代理绕过备案

原文http://tom.cat/?p=39

后来改进了一下,使用自定义请求头,阿里云对80端口扫描拦截非备案域名流量,是依据请求头的host来识别,改成8888端口后,又遭遇流量限速的问题,这个当初用日本的云服务器测试过得出来的结论,即国外服务器反代进来用备案域名访问速度非常快,非备案的基本上打开网页都困难,速度极其的慢。

解决方式如下

国内阿里云服务器端nginx配置

server {
        listen       8888;
        server_name  ~^(www\.)?(.+)$;

        location / {
		    proxy_redirect  off;
            proxy_set_header Host $http_x_host_x;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			if ($http_x_host_x = 'tom.cat') {
				proxy_pass   http://localhost:8089;
				break ;
			}
			if ($http_x_host_x = 'whois.ci') {
				proxy_pass   http://localhost:8089;
				break ;
			}
            proxy_pass   http://localhost:8088;
        }
}

国外搬瓦工服务器端nginx配置

server {
        listen       80;
        server_name  tom.cat;
	location / {
		proxy_redirect  off;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Host-X $host;
		proxy_pass   http://www.xxx.com:8888/;
        }
}
server {
        listen       80;
        server_name  whois.ci;
	location / {
		proxy_redirect  off;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Host-X $host;
		proxy_pass   http://www.xxx.com:8888/;
        }
}

http配置节点需增加underscores_in_headers on;启用自定义请求头

nginx接收自定义请求头需要注意,搬瓦工端用X-Host-X,阿里云端用$http_x_host_x接收,即大写转小写,中横线转下划线,加 http_ 前缀

以上这样配置解决了访问速度的问题,接下来进入正题,现在搬瓦工不续费了,采用CDN来替代搬瓦工这个角色

CDN服务商:https://cdn.umistrong.com.cn/

进CDN后台添加域名,业务区域选择无备案,源站地址需要填写已备案的域名

添加域名后,按照要求认证域名并添加cname解析

进域名高级设置–>Header配置–>请求头配置

进域名缓存配置–>缓存规则表–>缓存规则

搞定结束!

“利用CDN让无法备案的域名使用国内服务器”的14个回复

  1. I needed to compose you the little bit of observation to be able to say thanks over again for those awesome principles you’ve provided on this site. It’s certainly surprisingly open-handed with you to provide easily all that a lot of people would have advertised for an e-book to get some cash for their own end, chiefly seeing that you could have done it in case you desired. These principles in addition acted to be a great way to be certain that many people have a similar desire like my own to realize a lot more in terms of this matter. I am sure there are numerous more enjoyable periods in the future for people who start reading your blog post.

  2. I not to mention my guys were found to be following the good ideas on your web blog and then instantly developed a horrible suspicion I had not thanked the web site owner for them. All of the men had been as a consequence excited to study them and have in effect seriously been taking advantage of these things. Many thanks for genuinely so considerate and for deciding on such helpful guides millions of individuals are really eager to discover. Our honest apologies for not expressing appreciation to sooner.

  3. I not to mention my buddies were digesting the excellent items from your web page and so quickly I got a terrible feeling I never thanked the blog owner for those techniques. Those ladies were definitely for that reason warmed to learn them and have in effect undoubtedly been taking pleasure in them. Many thanks for actually being so considerate and then for pick out some magnificent information millions of individuals are really eager to be informed on. Our own honest regret for not expressing gratitude to earlier.

  4. I am also commenting to make you be aware of what a excellent experience our princess found using yuor web blog. She realized so many issues, with the inclusion of how it is like to possess a marvelous helping style to make many more with no trouble grasp chosen very confusing matters. You actually did more than people’s expected results. Thanks for distributing these great, dependable, revealing and in addition fun thoughts on that topic to Evelyn.

  5. I am glad for writing to make you understand of the terrific encounter my friend’s daughter found going through your web site. She mastered too many things, not to mention what it is like to have a marvelous helping mood to have folks smoothly grasp a variety of tortuous topics. You actually did more than our own expectations. Many thanks for delivering those great, trusted, revealing and as well as unique tips about the topic to Jane.

  6. I needed to send you that very small word so as to say thanks a lot once again with the marvelous knowledge you’ve shared in this article. It’s certainly shockingly generous with people like you to present unhampered exactly what most people could have offered for sale for an e-book to earn some bucks for themselves, most notably now that you might have done it in the event you wanted. The concepts as well worked as a great way to be sure that most people have the same eagerness much like my personal own to see great deal more with regard to this problem. I’m certain there are some more enjoyable sessions up front for individuals that check out your site.

  7. I simply needed to thank you so much all over again. I am not sure the things that I might have followed without the actual advice documented by you regarding this subject. It was actually the scary problem in my view, nevertheless spending time with a skilled form you dealt with that made me to cry with joy. Extremely grateful for this service as well as trust you comprehend what a great job you have been providing educating many people through your site. I am certain you haven’t come across any of us.

  8. I want to express my appreciation for your generosity giving support to those people that actually need help with your niche. Your personal commitment to getting the message all-around had become extremely informative and has constantly encouraged men and women just like me to realize their ambitions. Your insightful suggestions indicates a lot to me and further more to my office workers. Warm regards; from everyone of us.

  9. I simply wanted to thank you very much once more. I’m not certain the things I could possibly have carried out in the absence of those solutions revealed by you relating to such a topic. It had been a real difficult issue for me, however , taking note of your skilled fashion you solved that made me to jump over contentment. I’m just happy for your work and then hope you find out what a great job you are always putting in training the rest with the aid of your web site. Most likely you haven’t got to know any of us.

  10. I simply needed to say thanks once more. I do not know what I would have carried out without the entire information contributed by you concerning that area of interest. It seemed to be an absolute challenging setting for me personally, nevertheless viewing a new specialized form you solved the issue made me to cry with happiness. Extremely grateful for the service as well as expect you recognize what a powerful job you happen to be undertaking instructing other individuals using a site. I’m certain you’ve never come across any of us.

  11. I definitely wanted to send a brief message in order to appreciate you for all the fantastic techniques you are showing at this website. My extended internet look up has now been paid with awesome information to talk about with my classmates and friends. I would assume that most of us website visitors actually are unequivocally endowed to live in a fantastic site with very many perfect individuals with interesting concepts. I feel really lucky to have seen the webpage and look forward to tons of more thrilling moments reading here. Thanks once again for everything.

发表评论

电子邮件地址不会被公开。 必填项已用*标注