Tencent achieved under the cloud + Centos7.5 + Nginx1.12.2 - (custom domain name CSDN blog) using the two domain names website Jump

Look at the comparison of before and after the jump:

Blog address: https://blog.csdn.net/sinat_40471574

After the jump: http://blog.windfamily.cn

To achieve this function you first have to have a server and domain name.

Now talk about the specific steps to achieve:

A jump codes (HTML & JS):

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Blog</title>
</head>
<body>
	<script>
		window.location.href="https://blog.csdn.net/sinat_40471574";
	</script>
</body>
</html>

Second, add DNS records:

1. Log Tencent cloud -> Click on the top left corner Overview -> click on the icon cloud resolution.

2. the following figure: Click resolve -> Add Record -> host record second-level domain you want to write, record the value of your host public network ip, and other records as before, save it.

If the station had built before these operations should be no problem, the prompts on the Tencent cloud also very detailed, will not, then you can look at the tutorial Tencent cloud provides.

Third, the server configuration:

I use Xshell and Xftp, plus I am not very familiar with linux operation, so be a simple and crude way.

1. with Xshell login server, open Xftp, find /etc/nginx/nginx.conf file to the desktop, open with notepad, check there are no words, my file is on line 36, not to make up on. Of course, this is just to follow operate without modification nginx configuration files, if you do not do so directly written in this document is required.

 2. Create a new file in /etc/nginx/conf.d folder, such as blog.conf, document reads as follows:

server {
    listen       80;                            
    server_name  blog.windfamily.cn;            //域名

    location / {
        root   /usr/share/nginx/html/blog;      //放html文件的地方
        index  index.html;                      //首页的名字
    }

    error_page   500 502 503 504  /50x.html;    
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

3. The HTML code is written to a html file named index.html, then copied to the code shown in the above / usr / share / nginx / html / blog folder.

4. Check nginx configuration is given: nginx -t

    Restart nginx: service nginx restart

OK, all operations completed.

Published 34 original articles · won praise 26 · views 10000 +

Guess you like

Origin blog.csdn.net/sinat_40471574/article/details/90349283