Site building process-HTY

It took a lot of time to build a website, so I opened this article to remember it

My blog address is hty.ink

server

configuration

At the beginning, I used the Aliyun Beijing server. Because the bandwidth is too wide, I am currently using the cloud server VPS of the Dutch manufacturer liteserve. The configuration is 2 cores, 2G memory, 40G storage, 1G bandwidth, the price is 5 euros/month, and Alipay is supported. Pay, the VPS allocates 1 ipv4 public network address and a basically useless ipv6 address similar to the intranet. The image I chose for the server is CentOS 7.9

optimization

Open port 443

Sometimes the server will parachute, so I will open port 433 every time anyway. This configuration is only temporary, and restarting the server will restore it to the unconfigured state

/sbin/iptables -I INPUT -p tcp --dport 443 -j ACCEPT
/sbin/iptables -L -n
service iptables save

pagoda

Install

Use the pagoda to manage many things on the server. For the CentOS system, the installation command is

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

Downgrade to 7.7

Version 7.9 is installed by default. Since version 7.9 has many bug fixes, which is not conducive to scientific use, I will downgrade it to version 7.7. After installing 7.9, execute

wget http://download.bt.cn/install/update/LinuxPanel-7.7.0.zip
unzip LinuxPanel-7.7.0.zip
cd /root/panel
bash update.sh

optimization

Remove the stupid calculation questions and delays in the pagoda

Layout_file="/www/server/panel/BTPanel/templates/default/layout.html";
JS_file="/www/server/panel/BTPanel/static/bt.js";
if [ `grep -c "<script src=\"/static/bt.js\"></script>" $Layout_file` -eq '0' ];then sed -i '/{% block scripts %} {% endblock %}/a <script src="/static/bt.js"></script>' $Layout_file; fi;
wget http://f.cccyun.cc/bt/bt.js -O $JS_file;
bt restart code block
var foo = 'bar';

close security entrance

rm -f /www/server/panel/data/admin_path.pl

plug-in open

Just run the following code, this code is only valid for version 7.7, pay attention to join the scheduled task to repeat the process, because the pagoda background has a relevant protection mechanism, it is recommended to execute it every minute

cd  /www/server/panel/data/ && sed 's/\"endtime\": -1/\"endtime\": 9999999999999/g' plugin.json > plugin1.json && cp -f plugin1.json plugin.json
rm -rf /www/server/panel/data/plugin.json
mv /www/server/panel/data/plugin1.json plugin.json

WordPress configuration

The website is built using wordpress, and the configuration is as follows

start with two spaces

Wordpress articles or page paragraphs cannot implement the default two spaces at the beginning of Chinese articles. Refer to this article and add the following code directly at the end of the template function (function.php)

	//文章首行缩进
function Bing_text_indent(text){
    
    return = str_replace('<p', '<p style="text-indent:2em;"',text);
	returnreturn;
}
add_filter('the_content','Bing_text_indent');

Although this method solves the difficulty of having two spaces at the beginning, the first line of code entered into the article will also have two spaces at the beginning, so the correct code should be as follows

//文章首行缩进
function Bing_text_indent(text){
    
    return = str_replace('<p>', '<p style="text-indent:2em">',text);
	returnreturn;
}
add_filter('the_content','Bing_text_indent');
成功解决了第一个难题 (ฅ´ω`ฅ)

Images are automatically centered

Same as above, according to the gourd painting, add the following code

function Bing_img_indent(text){
    
    return = str_replace('<figure', '<figure align="center"',text);
	returnreturn;
}
add_filter('the_content','Bing_img_indent');

theme

After thousands of choices, Argon was finally finalized as the theme of the blog

It seems like an understatement here, but it actually took the most time

plug-in

  • Avatar Manager, modify background avatar
  • Imagify, automatically compress pictures
  • Super Fast SEO, optimization plugin, optimize site speed
  • WP Githuber MD, article editing with markdown
  • WP Statistics, statistics website browsing data
  • Google fonts and Gravatar avatar acceleration, optimized background
  • WordPress import tool for optimizing your site
  • Yoast SEO, increase the probability of search engine crawling
  • Google XML Sitemaps, automatically generate sitemaps
  • super cache, optimized site
  • XML Sitemap Generator for Google, automatically generate sitemaps
  • Link Manager, link management
  • Smush, automatically compress pictures

footer

In the theme footer file (footer.php) of the theme editor, locate the footer code, and I will modify it as follows

<p>
<a class="can_not_select" id="last_time_in_kaoyan"></a>
</p>
<style>
.can_not_select{
    
    
	 -webkit-touch-callout:none;  /*系统默认菜单被禁用*/
    -webkit-user-select:none; /*webkit浏览器*/
    -khtml-user-select:none; /*早期浏览器*/
    -moz-user-select:none;/*火狐*/
    -ms-user-select:none; /*IE10*/
    user-select:none;
}
</style>
<p>
		<a class="can_not_select">邮箱联系:</a>hty@hty.ink<a class="can_not_select">  </a><a class="can_not_select">微信联系:</a>DBY_HTY
</p>
<p>
	感谢<a href="https://github.com/solstice23/argon-theme" target="_blank" rel="noopener"> Argon </a>主题
</p>

font

Some fonts of this theme are too small, just add extra CSS at the custom place

ul {
    
    
font-size: 17px;
}
p {
    
    
font-size: 18px;
}

friend chain

Add a friend link in the link on the left column of the Wordpress background and save it, then create a new page and add the following code. Note, because there is a problem with embedding articles, here I deliberately changed the first letter f to F

[Friendlinks style="1" sort="link_id"/]

email reply

Just set the relevant parameters of the mailbox in the plug-in Super Fast SEO

Domestic visit

WeChat

Newly applied domain names with non-cn suffixes are usually blocked on WeChat, and customers who apply for restoration will hardly talk to you, even if you have filed for the record. The best way is to directly post an inquiry in the WeChat open community , the fastest and best processing effect

record

Since my initial server is a domestic server, I need to go through the filing process, and it took a total of about 2 weeks to successfully file the domain name

DNS acceleration

Currently using a foreign server, although the IP is not blocked, but the access speed is still slow, so use cloudflare for DNS acceleration

Guess you like

Origin blog.csdn.net/weixin_45756789/article/details/124078676