In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
The purpose of this article is to share with you the content of examples of slow acceleration of wordpress domestic network and fast CF handover against DDOS attacks. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Recently, some customers said that his website is abroad, but the speed of opening the domestic website is very slow, because domestic and foreign users visit frequently, hoping to improve the domestic visit speed of their website www.pjcourse.com. Their program uses wordpress. In general, wordpress's plug-in templates load a lot of data, even if you install cache plug-ins such as wprocket, do js,css compression, or optimize the database. In fact, the speed of the website will not be greatly improved.
After some simple analysis, I intend to move their website to the space dealer of the cn2 gia line, which is perhaps the fastest way to improve the speed of the website. Here are some of my hands-on sharing, and how to quickly switch data when a website is attacked.
Note: although this machine is put abroad, the probability of error such as 403 in Baidu spider crawling is almost gone.
I. Analysis of the situation of the current website
Before the site is relocated, the space placed in digitalocean,cdn is cloudflare. Although digitalocean is a very good space business abroad, for domestic users, access to cloudflare, so the speed is still very slow.
In addition, sub-line dns to do analysis, although it is also possible, but the operation will be more troublesome. So I won't discuss it in this article.
Through the seamless browser chrome, you can see that the speed is only opened in 6.35s. The previous rendering took 4.46 seconds.
In addition, the speed measurement of the home of the stationmaster can also be seen. The telecommunication line is a little faster. But the speed of Unicom and mobile is obviously more than 4 seconds.
# #
II. Website relocation
With regard to the choice of space quotient, in fact, as long as you choose the right stable space, good route. Basically, it's okay. I am now choosing the cn2 gia ecommerce of the bricklayer. The biggest advantage of cn2 gia is that the access to the three networks in China is very fast. And this space quotient is also the most stable. I am now $49.99 in the first quarter, which is actually equivalent to $16 a month.
SSD: 20 GB RAID-10
RAM: 1 GB
CPU: 2x Intel Xeon
Transfer: 1000 GB/mo
You can choose different hosts according to each person's situation. However, it is recommended that when the traffic is not very large at the beginning, you do not need to buy a very good host, and you can expand the capacity later.
# #
1. Operating system selection
I use ubuntu 20.04. Php 7.4 + nginx + mysql. Why did you choose this. Because php 7.4 is 30% faster than php 7.2.
# #
2. Command line
Why not use the pagoda? Because there was a big loophole in the pagoda some time ago. And in this part of the website, I feel that I should try my best to use less other third-party tools. In addition, the built VPS can also be as clean and tidy as possible. Fewer external programs.
The following command line is based on ubuntu 20.04. Just follow orders. There's nothing wrong with it.
Ssh root@...-p port number
The asterisk is the IP address. -p is the designated port. Because the default ssh port for the bricklayer is not 22, it should be specified here.
# # #
Step 1: install nginx
Sudo apt update
Sudo apt install nginx
# # #
Step 2: turn on the firewall
Sudo ufw app list
Sudo ufw allow 'OpenSSH'
Sudo ufw allow 'Nginx HTTPS'
Sudo ufw allow 'Nginx HTTP'
Sudo ufw enable-when this command finishes, it prompts you that the ssh connection may be broken. Enter y directly and enter enter.
# # #
Step 3: install mysql
Sudo apt install mysql-server
Sudo mysql_secure_installation (this step is optional, which is a security script).
Enter y enter, select 2, the strongest password, enter a new password, this password is the root password of mysql.
Then choose y for all. One is to remove anonymous users, one is to disable remote login of the database root, and finally to remove the test database.
Finally, choose y. The script takes effect immediately.
# # #
Step 4: install the php module
Sudo apt install php-imagick php7.4-fpm php7.4-mbstring php7.4-bcmath php7.4-xml php7.4-mysql php7.4-common php7.4-gd php7.4-json php7.4-cli php7.4-curl php7.4-zip
Here is a command, and the entire code can be copied. This basically contains all the modules that can be used by wordpress.
Sudo systemctl reload php7.4-fpm nginx (restart and load configuration)
# # #
Step 5: bring the data from the website
Because my website is wordpress, maybe your website is written by another program, so the content is different. I won't write it here. Also, remember to do the nginx.conf under the / etc/nginx/sites-enable/ directory
Server {
Listen 80
Server_name your_domain www.your_domain
Root / var/www/your_domain
Index index.html index.htm index.php;location / {try_files $uri $uri/ = 404;} location ~\ .php$ {include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;} location ~ /\ .ht {deny all;}
Replace the your_domain in the configuration file with your domain name * com
# # #
Step 6: configure and install ssl
Ssl, I'm using let's encrypt.
Sudo apt install certbot python3-certbot-nginx
Sudo certbot-nginx-d example.com-d www.example.com
Replace example.com with the domain name of your own website. If it is multiple subdomain names. Just add it yourself.
Note here that you must first point the dns to the current VPS, otherwise the configuration will not be successful if you use Cloudflare. To close CDN.
I saw the last sentence. Congratulations! Your certificate and chain have been saved at:
It means the installation is successful.
This certificate is valid for 90 days, but certbot runs two systemd timers a day to check the validity of the certificate and renew it automatically. You need to check whether the timer works.
Sudo systemctl status certbot.timer
The output result is as follows, which means that it is normal.
● certbot.timer-Run certbot twice daily
Loaded: loaded (/ lib/systemd/system/certbot.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Mon 2020-05-04 20:04:36 UTC; 2 weeks 1 days ago
Trigger: Thu 2020-05-21 05:22:32 UTC; 9h left
Triggers: ● certbot.service
# #
Third, test the Internet speed of the new website
Direct access to domestic telecommunications, the opening time of the website has been significantly improved. Compared with the previous speed, it has increased by about 2-3 times. And it's still the speed of the night. The speed of the visit at night was not affected at all.
Except for the dns resolution of one of the addresses marked red has not yet taken effect, the rest of the IP that is already in effect are obviously opened within 2 seconds.
# #
4. Defense against DDOS attacks and cloudflare fast switching attack and defense
Here I recommend using cloudflare to configure your website. By default, CDN is not enabled. That is, the domain name points directly to IP. However, if you encounter attacks such as ddos, it is recommended that you immediately turn on the cloudflare proxy and point the IP to the clone space where you back up. Because IP is hidden and a large amount of attack data from attackers will be filtered by Cloudflare, you can restore your site in just a few minutes as long as you respond in a timely manner.
In addition, you can use the access.log access log to locate your attack source IP. And filter the suspicious IP directly in the firewall of cloudflare. Such as blocking access, or CAPTCHA to locate the attacker. And the option of cf can also block the whole country.
In addition, turn on under attack mode. Can effectively prevent small and medium-sized attacks.
Thank you for reading! On "wordpress domestic network speed slow acceleration and anti-DDOS attacks fast CF switching example" this article shares here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.