<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kunzhu0710</title>
    <description>The latest articles on DEV Community by kunzhu0710 (@kunzhu0710).</description>
    <link>https://dev.to/kunzhu0710</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F885343%2F67a156a0-352e-4a5a-998f-79ab03e2d1c6.png</url>
      <title>DEV Community: kunzhu0710</title>
      <link>https://dev.to/kunzhu0710</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kunzhu0710"/>
    <language>en</language>
    <item>
      <title>Tencent Cloud COS enables FTP function</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Mon, 18 Jul 2022 07:36:15 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/tencent-cloud-cos-enables-ftp-function-2005</link>
      <guid>https://dev.to/kunzhu0710/tencent-cloud-cos-enables-ftp-function-2005</guid>
      <description>&lt;p&gt;My website has always used Tencent Cloud's &lt;a href="https://www.tencentcloud.com/product/cos?from_social=dev_14"&gt;COS&lt;/a&gt; , and static resources such as pictures, JS, and CSS exist on it, and the speed is ideal. But there is a common point: file management is quite inconvenient. Although uploading files can support a single file of 20G, deleting files can only be deleted one by one, and when there are files in the folder, they cannot be deleted. Delete things one by one, then delete the folder. Some people may say, just put it there, it doesn't affect it anyway, but for my obsessive-compulsive disorder, this is unbearable! ! Sometimes I really delete one by one, it's really hard.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_mPYYUOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://ask.qcloudimg.com/http-save/yehe-1076268/4inig84v5j.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_mPYYUOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://ask.qcloudimg.com/http-save/yehe-1076268/4inig84v5j.gif" alt="image" width="1" height="1"&gt;&lt;/a&gt;&lt;br&gt;
So today I did some research on the Internet and found that there is an official API on the Internet to write scripts for batch control, which is not bad, and the wp plug-in is used. Next is the focus of this article, super invincible and convenient: apply for official FTP permissions to manage files.&lt;br&gt;
step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Log in to Tencent Cloud official website and enter the console;&lt;/li&gt;
&lt;li&gt;Click on the upper right corner: work order - my work order;&lt;/li&gt;
&lt;li&gt;Left: Submit a work order - please select the problem category - storage and CDN - &lt;a href="https://www.tencentcloud.com/product/cos?from_social=dev_14"&gt;object storage&lt;/a&gt; COS;&lt;/li&gt;
&lt;li&gt;Then select: Enable FTP function. Fill in the Bucket for which you want to enable the FTP function below;&lt;/li&gt;
&lt;li&gt;You're done! The review speed did not say, I had to pass it in about 7-8 minutes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_mPYYUOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://ask.qcloudimg.com/http-save/yehe-1076268/4inig84v5j.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_mPYYUOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://ask.qcloudimg.com/http-save/yehe-1076268/4inig84v5j.gif" alt="image" width="1" height="1"&gt;&lt;/a&gt;&lt;br&gt;
At this point, it is almost completed, the rest is to create an FTP account (object storage service-Bucke list-modify configuration-FTP settings), and then log in with Winscp, you can see all files, no more Every time I upload a file, I have to log in to the official website and upload it. You can operate it at will here. Of course, the risk is also greater. If you make a mistake, it will be in vain. Here are some instructions for FTP:&lt;br&gt;
Client configuration:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Address: &lt;a href="ftp://ftp.file.myqcloud.com"&gt;ftp://ftp.file.myqcloud.com&lt;/a&gt; Port number: 9421 Encryption method: TLS explicit encryption (recommended) or no encryption (not recommended) Connection mode: pasv Passive mode timeout setting: 300 seconds (recommended)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Functional limitations:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Download operations are not supported. Remote move, copy, and rename operations are not supported. The maximum file limit is 100 MB.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>Tencent cloud cos upload file template</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 08:50:06 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/tencent-cloud-cos-upload-file-template-gam</link>
      <guid>https://dev.to/kunzhu0710/tencent-cloud-cos-upload-file-template-gam</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# -*- coding=utf-8
# 1. set config, 包括 secretId，secretKey 以及 Region
# python3 install
# pip3 install qcloud_cos_py3
# pip3 install cos-python-sdk-v5
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
import sys

secret_id = 'xxxxxx'  
secret_key = 'xxxxxxx'  
region = 'ap-shanghai'  
APPID = "xxxxxx"  # APPID
bucket_name = "xxxx"  
bucket = f'{bucket_name}-{APPID}' 
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
# 2. get client object
client = CosS3Client(config)


def cos_list_buckets():

    response = client.list_buckets(
    )
    print(response)


def cos_bucket_status(Bucket):

    try:
        response = client.head_bucket(
            Bucket=Bucket,
        )
        if not response:
            return True
    except:
        return None


def cos_upload_file(Bucket, LocalFilePath, Key):

    response = client.upload_file(
        Bucket='xxxxxx',  
        LocalFilePath=LocalFilePath,  
        Key=Key,  
    )
    ETag = response["ETag"]
    return f'https://{Bucket}.cos.{region}.myqcloud.com/{Key}'


if __name__ == '__main__':
    bucket = 'xxxx'
    LocalFilePath = 'test.jpeg'  
    Key = 'test.jpeg' 

    print(cos_upload_file(bucket, LocalFilePath, Key))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://cloud.tencent.com/product/cos?from_social=dev_13"&gt;tencent cloud cos&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Playing with Tencent Cloud CVM to test external network bandwidth</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 07:48:46 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/playing-with-tencent-cloud-cvm-to-test-external-network-bandwidth-1bcg</link>
      <guid>https://dev.to/kunzhu0710/playing-with-tencent-cloud-cvm-to-test-external-network-bandwidth-1bcg</guid>
      <description>&lt;p&gt;In the cloud environment, CVMs generally access the network through multi-line BGP. In the actual use process, users may encounter situations where the bandwidth of the external network does not meet expectations. Under normal circumstances, as long as the terminal operator is a domestic and foreign mainstream operator, the operator will directly interconnect with Tencent Cloud, and the inbound and outbound bandwidth of CVM can meet expectations. If the client is a small operator and there is no access to the cloud, the inbound and outbound bandwidth of the CVM is often not up to the standard due to cross-operator communication. In this case, it is generally necessary to use a third-party speed measurement tool to prove that the inbound and outbound bandwidth on the cloud is normal.&lt;br&gt;
Generally for bandwidth and latency testing, Speedtest is usually used, which is the most popular and most reliable method for measuring Internet performance. With Speedtest, you can accurately test the connection speed of any device at any time at home, at work, or on the go. Speedtest does not rely on background testing to covertly collect data at inappropriate times. Speedtest's analytics are based solely on actual internet speeds experienced by hundreds of millions of consumers around the world. Speedtest has 8,500 test points around the world, which can guarantee the greatest possible measurement of the real actual bandwidth during the test.&lt;/p&gt;

&lt;h1&gt;
  
  
  Windows System Bandwidth Test
&lt;/h1&gt;

&lt;p&gt;The test method for Windows is relatively simple. You only need to use the flow device to visit the &lt;a href="https://www.speedtest.net"&gt;https://www.speedtest.net&lt;/a&gt; website to test. The webpage is based on html5 and can be tested without installing the Flash plug-in on the client side. The system will automatically recommend the nearest test point for testing according to the client's access IP address, and you can directly click the GO button to test.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cntgHCh4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/kwbuf3rhwr.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cntgHCh4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/kwbuf3rhwr.png%3FimageView2/2/w/1620" alt="image" width="835" height="567"&gt;&lt;/a&gt;Visit Speedtest.net website and click the GO button to test&lt;br&gt;
First, the delay is tested. The delay test is based on the delay statistics from the client to the speedtest test node. The download bandwidth and upload bandwidth of the client are tested. After the test, the maximum value of the final test result will be printed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CoA_yU28--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/paaz8psj4o.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CoA_yU28--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/paaz8psj4o.png%3FimageView2/2/w/1620" alt="image" width="" height=""&gt;&lt;/a&gt;Speedtest test results display&lt;/p&gt;

&lt;h1&gt;
  
  
  Linux system bandwidth test
&lt;/h1&gt;

&lt;p&gt;Since most of the Linux systems on the cloud do not have a desktop environment installed, the browser is used to access the speed test website for testing. This article uses the test script provided by Speedtest to perform network testing on the command line interface. For specific test scripts, you can visit &lt;a href="https://github.com/suxin1110/SpeedTest"&gt;GitHub&lt;/a&gt; to download the test scripts, or run the following commands directly on the system to download:&lt;br&gt;
  &lt;code&gt;git clone https://github.com/suxin1110/SpeedTest.git&lt;/code&gt; &lt;br&gt;
The downloaded py script needs to execute the following command to directly perform the delay and external network inbound and outbound bandwidth test in bash&lt;br&gt;
 &lt;code&gt;chmod a+rx speedtest.py&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;sudo mv speedtest.py /usr/local/bin/speedtest&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;sudo chown root:root /usr/local/bin/speedtest&lt;/code&gt; &lt;br&gt;
At this point, you can directly type speedtest in bash to test, or test the delay first, and then test the download and upload bandwidth from the Internet.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--doWzXFmL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/80ooyb5az2.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--doWzXFmL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/80ooyb5az2.png%3FimageView2/2/w/1620" alt="image" width="828" height="261"&gt;&lt;/a&gt;Enter the speedtest command on the Linux command line interface to start the test script&lt;br&gt;
Here are some simple speedtest test commands&lt;br&gt;
 &lt;code&gt;speedtest&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;speedtest --share&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;speedtest --list&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;speedtest --server ***&lt;/code&gt; &lt;br&gt;
For detailed speedtest test commands, you can directly type speedtest -h to view the help description.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Migrate Apache data on Tencent Cloud CVM</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 07:40:43 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/migrate-apache-data-on-tencent-cloud-cvm-37h8</link>
      <guid>https://dev.to/kunzhu0710/migrate-apache-data-on-tencent-cloud-cvm-37h8</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;On Debian 8, the Apache2 web server default file is  &lt;code&gt;/var/www/html&lt;/code&gt; in . This directory is located on the root file system along with the operating system. You might want to move the document to another directory, such as mounting the filesystem separately.&lt;br&gt;
In this tutorial, you will migrate Apache default files to a new location by moving files and changing Apache's configuration files.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Prepare&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To complete this tutorial, you will need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A non-root Debian 8 server that can use the sudo command, I recommend using Tencent Cloud's configured server . Or use Tencent Cloud Developer Lab for*&lt;em&gt;free&lt;/em&gt;* to experiment.&lt;/li&gt;
&lt;li&gt;An Apache2 web server. For the installation tutorial, you can refer to here.&lt;/li&gt;
&lt;li&gt;Move the new location of the directory, here I use Tencent Cloud's file storage service .&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this tutorial, we will use a directory, which points to a &lt;a href="https://intl.cloud.tencent.com/product/cfs?from_social=dev_11"&gt;file storage&lt;/a&gt; &lt;code&gt;/mnt/volume-nyc1-01&lt;/code&gt;  service mounted to the server .&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1 - Copy the files to the new location&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When installing a fresh Apache, the document root is located at  &lt;code&gt;/var/www/html&lt;/code&gt; . If you have a lot of websites on your server, the documentation directory will be different, and it is recommended that you search using the scheme below.&lt;br&gt;
You can  &lt;code&gt;grep&lt;/code&gt; search the directory for Apache configuration documentation using the  &lt;code&gt;/etc/apache2/sites-enabled&lt;/code&gt; following command:&lt;br&gt;
 &lt;code&gt;grep -R "DocumentRoot" /etc/apache2/sites-enabled&lt;/code&gt; copy&lt;br&gt;
 &lt;code&gt;-R&lt;/code&gt; The flag ensures that  &lt;code&gt;grep&lt;/code&gt; the contents of the DocumentRoot are output in it.&lt;br&gt;
The results will be similar to the following, if you install the site multiple results names and numbers may be different:&lt;br&gt;
 &lt;code&gt;sites-enabled/000-default.conf   DocumentRoot /var/www/html&lt;/code&gt; copy&lt;br&gt;
Now that you have confirmed the location of the document root,  &lt;code&gt;rsync&lt;/code&gt; copy the files to the new location using the command.&lt;br&gt;
First, install with the following command  &lt;code&gt;rsync&lt;/code&gt; :&lt;br&gt;
 &lt;code&gt;sudo apt-get install rsync&lt;/code&gt; copy&lt;br&gt;
Then execute this command to copy the files:&lt;br&gt;
 &lt;code&gt;sudo rsync -av /var/www/html /mnt/volume-nyc1-01&lt;/code&gt; copy&lt;br&gt;
Using  &lt;code&gt;-a&lt;/code&gt; flags preserves permissions and other directory attributes, while  &lt;code&gt;-v&lt;/code&gt; providing verbose output so you can track progress.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Make sure there are no trailing slashes on the directory. When there is a slash, rsync dumps the contents of the directory to the mount point instead of transferring it into the html directory.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These files will be synced to the new location, but now that the Apache configuration files are still using the old directory, we need to configure the new files.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Step 2 - Update the configuration file&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;By default Apache comes with two &lt;a href="https://intl.cloud.tencent.com/product/lighthouse?from_social=dev_11"&gt;virtual host&lt;/a&gt; files,  &lt;code&gt;000-default.conf&lt;/code&gt; and  &lt;code&gt;default-ssl.conf&lt;/code&gt; .&lt;br&gt;
First edit the  &lt;code&gt;000-default.conf&lt;/code&gt; file:&lt;br&gt;
 &lt;code&gt;sudo nano /etc/apache2/sites-enabled/000-default.conf&lt;/code&gt; copy&lt;br&gt;
Find  &lt;code&gt;DocumentRoot&lt;/code&gt; the line starting with and update it with the new position:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;
 ...
        ServerAdmin webmaster@localhost
        DocumentRoot /mnt/volume-nyc1-01/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Next, look up Directory to see if it points to the original path, we need to update it to the new path. In a fresh install of Apache, there is no entry in the Directory default site. Add the following code to the configuration file so that Apache can use the new file from the new location:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ...
     ServerAdmin webmaster@localhost
     DocumentRoot /mnt/volume-nyc1-01/html
​
     &amp;lt;Directory /&amp;gt;
         Options FollowSymLinks
         AllowOverride None
     &amp;lt;/Directory&amp;gt;
     &amp;lt;Directory /mnt/volume-nyc1-01/html/&amp;gt;
         Options Indexes FollowSymLinks MultiViews
         AllowOverride None
         Require all granted
    &amp;lt;/Directory&amp;gt;
 ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
The first  &lt;code&gt;Directory&lt;/code&gt; block sets some restrictive default permissions, and the second block configures the options for the new web  &lt;code&gt;/mnt/volume-nyc1-01/html/&lt;/code&gt; in .&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You should look for the other location in the config file where the original path shows and change it to the new location. In addition to  &lt;code&gt;DocumentRoot&lt;/code&gt; and  &lt;code&gt;Directory&lt;/code&gt; settings, you can also find things like aliases and overrides that need to be updated. Wherever you  &lt;code&gt;grep&lt;/code&gt; see the path to the original document root in the output, you will need to update the path to reflect the new location.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After making the necessary changes, save the file.&lt;br&gt;
Next, we turn to SSL configuration. On a fresh install, SSL has not been configured, if you have never configured SSL, ignore the following.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If SSL is not enabled, the  &lt;code&gt;ssl-default.conf&lt;/code&gt; files are only in the  &lt;code&gt;/etc/apache2/sites-available&lt;/code&gt; directory. If you have SSL enabled, the server will  &lt;code&gt;sites-available&lt;/code&gt; link to the  &lt;code&gt;/etc/apache2/sites-enabled&lt;/code&gt; directory from the file. In this case, you can edit the file from either directory.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/apache2/sites-available/ssl-default.conf&lt;/code&gt; copy&lt;br&gt;
Make the same changes as before by making changes  &lt;code&gt;DocumentRoot&lt;/code&gt; and making sure to configure them correctly: &lt;code&gt;Directory&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ...
&amp;lt;IfModule mod_ssl.c&amp;gt;
  &amp;lt;VirtualHost _default_:443&amp;gt;
     ServerAdmin webmaster@localhost
     DocumentRoot /mnt/volume-nyc1-01
​
     &amp;lt;Directory /&amp;gt;
         Options FollowSymLinks
         AllowOverride None
     &amp;lt;/Directory&amp;gt;
     &amp;lt;Directory /mnt/volume-nyc1-01/html/&amp;gt;
         Options Indexes FollowSymLinks MultiViews
         AllowOverride None
         Require all granted
    &amp;lt;/Directory&amp;gt;
 ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
After making configuration changes, make sure the syntax is correct with the following command:&lt;br&gt;
 &lt;code&gt;sudo apachectl configtest&lt;/code&gt; copy&lt;br&gt;
You will see results like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AH00558: apache2: Could not reliably determine the server's fully qualified domain name, 
using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
In a default installation, you will see the preceding message, which you can safely ignore. As long as you see Syntax OK, restart the web server.&lt;br&gt;
Restart Apache with the following command:&lt;br&gt;
 &lt;code&gt;sudo systemctl reload apache2&lt;/code&gt; copy&lt;br&gt;
After the server restarts, go to the website you changed, and if all is well, don't forget to delete the original copy of the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;in conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this tutorial, you learn to change the Apache document root to a new location. This can help you with basic web server management, and it also allows you to take advantage of other storage devices, such as &lt;a href="https://www.tencentcloud.com/products/cfs?from_social=dev_11"&gt;Tencent Cloud File Storage Service&lt;/a&gt; , an important step in scaling your website as your needs change.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Play with Tencent Cloud CVM to build a WordPress site</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:28:27 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/play-with-tencent-cloud-cvm-to-build-a-wordpress-site-iip</link>
      <guid>https://dev.to/kunzhu0710/play-with-tencent-cloud-cvm-to-build-a-wordpress-site-iip</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_10"&gt;Cloud Virtual Machine (CVM)&lt;/a&gt; provides you with secure and flexible computing capabilities. You can enable CVM in the cloud in just minutes to meet your diverse computing needs. Through &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_10"&gt;CVM&lt;/a&gt;, you can easily scale up or down your computing resources as your business needs change. Billed based on your actual resource consumption, CVM reduces your computing costs and simplifies IT-related OPS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Operation scene
&lt;/h1&gt;

&lt;p&gt;WordPress is a commonly used software for building personal blog websites, which is developed using PHP language. You can deploy WordPress and publish your personal blog through simple operations on Tencent Cloud servers.&lt;br&gt;
This article introduces the method of manually deploying WordPress. If your website does not have high requirements for scalability, Tencent Cloud also provides an image method to deploy WordPress. For details, please refer to Deploying WordPress Using an Image .&lt;br&gt;
This tutorial takes the Linux system CentOS 7.5 as an example to build a WordPress personal site. The specific operation methods are as follows:&lt;/p&gt;

&lt;h1&gt;
  
  
  Related Introduction
&lt;/h1&gt;

&lt;p&gt;The following are the services or tools that will be used in this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud server&lt;/strong&gt; : This tutorial uses Tencent Cloud Cloud Server (Cloud Virtual Machine, CVM) to create a cloud server instance to complete the construction of WordPress.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domain Name Registration&lt;/strong&gt; : If you want to use an easy-to-remember domain name to access your WordPress site, you can use Tencent Cloud Domain Name Registration Service to purchase a domain name.&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;Website *&lt;/em&gt;&lt;a href="https://intl.cloud.tencent.com?from_social=dev_10"&gt;&lt;strong&gt;filing&lt;/strong&gt;&lt;/a&gt; : For websites whose domain names point to servers in China, website filing is required. Before the domain name obtains the record number, the website cannot be opened for use. You can record your domain name through the Tencent Cloud &lt;a href="https://intl.cloud.tencent.com?from_social=dev_10"&gt;website record product.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://intl.cloud.tencent.com/product/ba?from_social=dev_10"&gt;&lt;strong&gt;Cloud&lt;/strong&gt;&lt;/a&gt; DNS: After configuring domain name resolution, users can access your website through the domain name without using complex IP addresses to access your website. You can resolve domain names through Tencent Cloud's &lt;a href="https://intl.cloud.tencent.com/product/ba?from_social=dev_10"&gt;cloud&lt;/a&gt; DNS service.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Preconditions
&lt;/h1&gt;

&lt;p&gt;You have logged in to the &lt;a href="https://intl.cloud.tencent.com?from_social=dev_10"&gt;cloud&lt;/a&gt; server console .&lt;/p&gt;

&lt;h1&gt;
  
  
  Steps
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Create and log in to a cloud server
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: This step is for a new purchase of a cloud server. If you have purchased a cloud server instance, you can choose the WordPress website building system by reinstalling the system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;On the Instance List page, click New. For details, see QuickConfiguration of Linux ECS .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the cloud server is successfully created, return to the cloud server console to view and obtain the following information about the instance. As shown below:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Cloud server instance username and password&lt;/li&gt;
&lt;li&gt;Cloud server instance public IP&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Build LNMP environment
&lt;/h2&gt;

&lt;p&gt;LNMP is short for Linux, Nginx, MariaDB, and PHP, and this combination is one of the most common operating environments for web servers. After creating and logging in to the cloud server instance, you can start to build the LNMP environment. LNMP composition and use version description:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linux: Linux system, this article uses CentOS7.5&lt;/li&gt;
&lt;li&gt;Nginx: Web server program, used to parse Web programs, this article uses Nginx1.12.2&lt;/li&gt;
&lt;li&gt;MariaDB: A database management system, this article uses MariaDB10.2.4&lt;/li&gt;
&lt;li&gt;PHP: A program for generating web pages by a web server. This article uses PHP7.2.17&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Install software and configure using yum
&lt;/h3&gt;

&lt;p&gt;After logging in to the cloud server, you have obtained root privileges by default. With root privileges, follow the steps below to install step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install and configure Nginx
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Execute the following command to install Nginx. &lt;code&gt;yum -y install nginx&lt;/code&gt; 

&lt;ol&gt;
&lt;li&gt;Execute the following command to open the  &lt;code&gt;nginx.conf&lt;/code&gt; file.
&lt;code&gt;vim /etc/nginx/nginx.conf&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Press " &lt;strong&gt;i&lt;/strong&gt; " or " &lt;strong&gt;Insert&lt;/strong&gt; " to switch to edit mode,  &lt;code&gt;nginx.conf&lt;/code&gt; and replace the contents of server{...} in the file with the following. It is used to cancel the monitoring of IPv6 addresses, and configure Nginx to realize linkage with PHP.
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
 listen       80;
 root   /usr/share/nginx/html;
 server_name  localhost;
 #charset koi8-r;
 #access_log  /var/log/nginx/log/host.access.log  main;
 #
 location / {
         index index.php index.html index.htm;
 }
 #error_page  404              /404.html;
 #redirect server error pages to the static page /50x.html
 #
 error_page   500 502 503 504  /50x.html;
 location = /50x.html {
     root   /usr/share/nginx/html;
 }
 #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
 location ~ .php$ {
     fastcgi_pass   127.0.0.1:9000;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
     include        fastcgi_params;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press " &lt;strong&gt;Esc&lt;/strong&gt; ", enter " &lt;strong&gt;:wq&lt;/strong&gt; ", save the file and return.&lt;/li&gt;
&lt;li&gt;Execute the following commands in sequence to start Nginx and set it to auto-start at boot. &lt;code&gt;systemctl start nginx&lt;/code&gt; 
&lt;code&gt;systemctl enable nginx&lt;/code&gt; 
In a browser, visit the public IP address of the CentOS cloud server instance to check whether the Nginx service is running normally. If the following is displayed, it means that the Nginx installation and configuration are successful.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tWRbldKm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://main.qcloudimg.com/raw/dc7ccc6220299225de75c521620423b4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tWRbldKm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://main.qcloudimg.com/raw/dc7ccc6220299225de75c521620423b4.png" alt="image" width="880" height="538"&gt;&lt;/a&gt;Verify that nginx is installed successfully&lt;/p&gt;

&lt;h2&gt;
  
  
  Install and configure PHP
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Execute the following command to update the PHP mirror source in yum. &lt;code&gt;rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm&lt;/code&gt; 
&lt;code&gt;rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm&lt;/code&gt; 

&lt;ol&gt;
&lt;li&gt;Execute the following command to view all packages of PHP 7.2 that can be installed.
&lt;code&gt;yum search php72w&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following commands to install the required packages.
&lt;code&gt;yum -y install mod_php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-mysqlnd php72w-fpm.x86_64&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following commands in sequence to start the PHP-FPM service and set it to auto-start at boot.
&lt;code&gt;systemctl start php-fpm systemctl enable php-fpm&lt;/code&gt; &lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Verify PHP-Nginx environment configuration
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Execute the following command to create a  &lt;code&gt;index.php&lt;/code&gt; file in the web directory. &lt;code&gt;vim /usr/share/nginx/html/index.php&lt;/code&gt; 

&lt;ol&gt;
&lt;li&gt;Press " &lt;strong&gt;i&lt;/strong&gt; " or " &lt;strong&gt;Insert&lt;/strong&gt; " key to switch to edit mode, and write the following content.
&lt;code&gt;&amp;lt;?php  echo "hello world!"; ?&amp;gt;&lt;/code&gt; 
Press " &lt;strong&gt;Esc&lt;/strong&gt; ", enter " &lt;strong&gt;:wq&lt;/strong&gt; ", save the file and return.
In a browser, visit the  &lt;code&gt;index.php&lt;/code&gt; file to see if the environment configuration was successful.
&lt;code&gt;http://云服务器实例的公网 IP/index.php&lt;/code&gt; 
If the page is displayed as follows, the LNMP environment configuration is successful.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qI2Bbc1l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://main.qcloudimg.com/raw/7a61a5dcc24ca00b9a50036a0ba1aa12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qI2Bbc1l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://main.qcloudimg.com/raw/7a61a5dcc24ca00b9a50036a0ba1aa12.png" alt="image" width="880" height="121"&gt;&lt;/a&gt;Verify PHP-Nginx environment configuration&lt;/p&gt;

&lt;h2&gt;
  
  
  Install and configure MariaDB
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Execute the following command to check whether there is an existing MariaDB package in the system.
&lt;code&gt;rpm -qa | grep -i mariadb&lt;/code&gt; 
If the returned result is similar to the following, it means that MariaDB already exists, go to step 2.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H-hIL0JR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://main.qcloudimg.com/raw/6fa7fb51de4a61f4da08eb036b6c3e85.png" alt="image" width="445" height="85"&gt;The mariadb component installed by default in CVM&lt;/li&gt;
&lt;li&gt;Execute the following command to delete the existing MariaDB package.
&lt;code&gt;yum remove 包名&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following command to install MariaDB.
&lt;code&gt;yum -y install mariadb mariadb-serve&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following commands in sequence to start the MariaDB service and set it to auto-start at boot.
&lt;code&gt;systemctl start mariadb systemctl enable mariadb&lt;/code&gt; 
Run the following commands to set the root account login password and basic configuration. Notice:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;For users who log in to MariaDB for the first time, execute the following commands to enter the user password and basic settings.&lt;/li&gt;
&lt;li&gt;After entering the root account password for the first time, you need to press " &lt;strong&gt;Enter&lt;/strong&gt; " (the interface is not displayed by default when the root password is set), and enter the root password again for confirmation. Please follow the prompts on the interface to complete the basic configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;mysql_secure_installation&lt;/code&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the following command to log in to MariaDB, enter the password set in step 5, and press Enter.
&lt;code&gt;mysql -uroot -p&lt;/code&gt; 
If the result is as follows, it has successfully entered MariaDB.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xqauungz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://main.qcloudimg.com/raw/0cfea29c0fa72075137a3dda0825c7a4.png" alt="image" width="778" height="210"&gt;
## Install and configure WordPress&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  download
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: WordPress can download the Chinese version of WordPress from the &lt;a href="https://cn.wordpress.org/"&gt;official WordPress website&lt;/a&gt; and install it. This tutorial uses the Chinese version of WordPress.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Execute the following command to delete the index.php file used to test the PHP-Nginx configuration in the root directory of the website.
&lt;code&gt;rm -rf /usr/share/nginx/html/index.php&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following commands in sequence, enter the /usr/share/nginx/html/ directory, and download and decompress WordPress.
&lt;code&gt;cd /usr/share/nginx/html wget https://cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gz&lt;/code&gt; 
&lt;code&gt;tar zxvf wordpress-4.7.4-zh_CN.tar.gz&lt;/code&gt; 
### configuration database&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before writing a blog, you need to build a database to store all kinds of data. Follow the steps below for MariaDB database configuration.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Execute the following command to log in to the MariaDB server as the root user.
&lt;code&gt;mysql -uroot -pXXXXX（安装配置 MariaDB 设置的登录密码）&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Run the following command to create the MariaDB database. For example "wordpress".
&lt;code&gt;CREATE DATABASE wordpress;&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following command to create a new user. For example "user@localhost".
&lt;code&gt;CREATE USER user@localhost;&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following command to set a password for the "user@localhost" user. For example "wordpresspassword".
&lt;code&gt;SET PASSWORD FOR user@localhost=PASSWORD("wordpresspassword");&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following command to give the user full permissions to the "wordpress" database.
&lt;code&gt;GRANT ALL PRIVILEGES ON wordpress.* TO user@localhost IDENTIFIED BY 'wordpresspassword';&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Execute the following commands to make all configurations take effect.
&lt;code&gt;FLUSH PRIVILEGES;&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Execute the following command to exit MariaDB.&lt;br&gt;
&lt;code&gt;exit&lt;/code&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  write database information
&lt;/h3&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Execute the following commands one by one, enter the WordPress installation directory, copy the wp-config-sample.php file to the wp-config.php file, and keep the original sample configuration file as a backup.&lt;br&gt;
&lt;code&gt;cd /usr/share/nginx/html/wordpress&lt;/code&gt; &lt;br&gt;
&lt;code&gt;cp wp-config-sample.php wp-config.php&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Execute the following command to open and edit the newly created configuration file.&lt;br&gt;
&lt;code&gt;vim wp-config.php&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press "i" or "Insert" to switch to the edit mode, find the MySQL part in the file, and write the information about the configured database in the configuration database.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; // ** MySQL settings - You can get this info from your web host ** //
 /** The name of the database for WordPress */
 define('DB_NAME', 'wordpress');

 /** MySQL database username */
 define('DB_USER', 'user');

 /** MySQL database password */
 define('DB_PASSWORD', 'wordpresspassword');

 /** MySQL hostname */
 define('DB_HOST', 'localhost');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After the modification is completed, press " &lt;strong&gt;Esc&lt;/strong&gt; ", enter " &lt;strong&gt;:wq&lt;/strong&gt; ", save the file and return.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Verify WordPress installation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Enter the public IP of the cloud server instance in the browser address bar or add the wordperss folder after the IP, for example:
&lt;code&gt;http://192.xxx.xxx.xx  http://192.xxx.xxx.xx /wordpress&lt;/code&gt; 
Go to the WordPress installation page and start configuring WordPress.
Configure WordPress&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the following installation information as prompted by the WordPress installation wizard, and click [Install WordPress] to complete the installation. Required Information Description Site Title WordPress Site Name. Username WordPress administrator name. For security reasons, it is recommended to set a name different from admin. Because this name is more difficult to crack than the default user name admin. The password can be a strong default password or a custom password. Do not reuse existing passwords, and be sure to keep them in a safe place. Your email The email address used to receive notifications.&lt;br&gt;
You can now log in to your WordPress blog with and start publishing blog posts.&lt;/p&gt;
&lt;h2&gt;
  
  
  Follow-up
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can set up a separate domain name for your WordPress blog site. Your users can access your website with an easy-to-remember domain name without complex IP addresses. You can purchase domain names through Tencent Cloud .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Websites whose domain names point to servers in China must be registered. Before the domain name obtains the record number, the website cannot be opened for use. You can record your website. The filing is free, and the review time is about 20 days.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need to configure domain name resolution on Tencent Cloud DNS before users can access your website through the domain name. For guidance, refer to Domain Name Resolution .&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In addition, you can scale service capacity horizontally and vertically on the Tencent Cloud platform, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expand the CPU and memory specifications of a single CVM instance to increase the processing power of the server. &lt;/li&gt;
&lt;li&gt;Add multiple CVM instances and use load balancing to balance load among multiple instances.&lt;/li&gt;
&lt;li&gt;With elastic scaling , the number of CVM instances can be automatically increased or decreased according to the business volume.&lt;/li&gt;
&lt;li&gt;Use object storage to store static web pages and massive pictures, videos, etc.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>tencentcloud</category>
      <category>cvm</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>Install Ghost Personal Blog on Tencent Cloud CVM</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:26:51 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/install-ghost-personal-blog-on-tencent-cloud-cvm-5720</link>
      <guid>https://dev.to/kunzhu0710/install-ghost-personal-blog-on-tencent-cloud-cvm-5720</guid>
      <description>&lt;p&gt;&lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_9"&gt;Cloud Virtual Machine (CVM)&lt;/a&gt; provides you with secure and flexible computing capabilities. You can enable CVM in the cloud in just minutes to meet your diverse computing needs. Through (CVM)[&lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_9"&gt;https://www.tencentcloud.com/products/cvm?from_social=dev_9&lt;/a&gt;] , you can easily scale up or down your computing resources as your business needs change. Billed based on your actual resource consumption, CVM reduces your computing costs and simplifies IT-related OPS.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;introduce&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ghost is a lightweight JavaScript blogging platform, open source under the MIT license Ghost is designed to simplify the process of publishing personal websites and publishing online. Ghost is a personal blogging system, which is developed using Node.jslanguage and MySQL database, and supports MySQL , MariaDB , SQLite and PostgreSQL . Users can use their own blogs on servers that supportNode.js.Ghost officially supports the version, and there are third-party Chinese Chinese versions developed by fans, such as Ghost's Chinese Chinese version. Ghost provides an API for developing plugins and customizable Handlebars theme template styles.&lt;br&gt;
In this tutorial, you will use the official  &lt;code&gt;ghost-cli&lt;/code&gt; Ghost instance to install on Ubuntu 16.04. We'll install Ghost, configure Nginx to proxy requests to Ghost, secure it with a Tencent Cloud free SSL certificate , and configure Ghost to run as a system service in the background.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Prepare&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To complete this tutorial, you will need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An Ubuntu 16.04 server, we recommend that you use Tencent Cloud's free developer lab to experiment.&lt;/li&gt;
&lt;li&gt;Install Node.js on your server, how to install Node.js please refer to this article&lt;/li&gt;
&lt;li&gt;Install Nginx on your server, how to install Nginx please refer to this article&lt;/li&gt;
&lt;li&gt;Install MySQL on your server, how to install MySQL please refer to this article&lt;/li&gt;
&lt;li&gt;Configure a domain name pointing to the server. You need to use the Tencent Cloud SSL certificate to enable SSL support through the installation of Ghost .&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: Install the Ghost CLI application&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ghost-cli&lt;/code&gt; We will install Ghost using the official program. The program installs Ghost, creates MySQL users and databases, configures Nginx as a reverse proxy, and secures the site with SSL/TLS encryption.&lt;br&gt;
First,  &lt;code&gt;npm&lt;/code&gt; download with  &lt;code&gt;ghost-cli&lt;/code&gt; :&lt;br&gt;
 &lt;code&gt;sudo npm i -g ghost-cli&lt;/code&gt; copy&lt;br&gt;
We put Ghost in the  &lt;code&gt;var/www/ghost&lt;/code&gt; directory, which is the recommended installation location. Create this directory:&lt;br&gt;
 &lt;code&gt;mkdir /var/www/ghost&lt;/code&gt; copy&lt;br&gt;
Then make sure your user owns this directory.&lt;br&gt;
 &lt;code&gt;sudo chown $USER:$USER /var/www/ghost&lt;/code&gt; copy&lt;br&gt;
 &lt;code&gt;/var/www/ghost&lt;/code&gt; The directory must have all permissions for your user, and read and execute for everyone else, so set the permissions with:&lt;br&gt;
 &lt;code&gt;sudo chmod 775 /var/www/ghost&lt;/code&gt; copy&lt;br&gt;
After installing the CLI and mounting the directory, we can set up our blog.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;The second step, install and configure Ghost&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Ghost CLI&lt;/code&gt; The application has an installation wizard that will walk you through all the steps to configure a working Ghost blog.&lt;br&gt;
Change to  &lt;code&gt;/var/www/ghost/&lt;/code&gt; directory .&lt;br&gt;
 &lt;code&gt;cd /var/www/ghost/&lt;/code&gt; copy&lt;br&gt;
Then  &lt;code&gt;ghost&lt;/code&gt; install Ghost with that command. It will configure Ghost to use MySQL as the default database. While you can use other databases, MySQL is the recommended choice.&lt;br&gt;
 &lt;code&gt;ghost install&lt;/code&gt; copy&lt;br&gt;
The installer will first make sure you have the necessary preparations installed, then download and install Ghost:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✔ Checking system Node.js version
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking operating system compatibility
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v1.22.2
✔ Finishing install process
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Once the installation process is complete, you will be prompted to enter your blog URL along with MySQL database information. &lt;strong&gt;Provide the root&lt;/strong&gt; username and password in this step . You can use the default  &lt;code&gt;ghost_prod&lt;/code&gt; as the database name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Enter your blog URL: http://example.com
? Enter your MySQL hostname: localhost
? Enter your MySQL username: root
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost_prod
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
The configuration wizard will create a &lt;strong&gt;ghost&lt;/strong&gt; system user and ask if a &lt;strong&gt;ghost&lt;/strong&gt; MySQL user should be created, you should allow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✔ Configuring Ghost
✔ Setting up instance
Running sudo command: useradd --system --user-group ghost
Running sudo command: chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes
✔ Setting up "ghost" mysql user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Next, it will ask you if you want to configure Nginx. Click OK and the installer will create the appropriate reverse proxy server block for your blog:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Do you wish to set up Nginx? Yes
✔ Creating nginx config file at /var/www/ghost/system/files/example.con.conf
Running sudo command: ln -sf /var/www/ghost/system/files/example.com.conf /etc/nginx/sites-available/example.com.conf
Running sudo command: ln -sf /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf
Running sudo command: nginx -s reload
✔ Setting up Nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Next, you will be prompted to set up SSL support. If you are using a registered domain name and have configured your DNS settings to point to your server's IP address, press N to continue.&lt;br&gt;
Output? Do you wish to set up SSL? NO&lt;br&gt;
First select NO here, and then we will apply for Tencent Cloud's SSL certificate for installation&lt;br&gt;
Next, the configuration wizard will prompt you to set up the systemd service. Press  &lt;code&gt;Y&lt;/code&gt; continue and the wizard will create a  &lt;code&gt;ghost_example-com&lt;/code&gt; new systemd service called and make it start on boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Do you wish to set up Systemd? Yes
✔ Creating systemd service file at /var/www/ghost/system/files/ghost_example-com.service
Running sudo command: ln -sf /var/www/ghost/system/files/ghost_example-com.service /lib/systemd/system/ghost_example-com.service
Running sudo command: systemctl daemon-reload
✔ Setting up Systemd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Finally, the wizard will configure your database and ask if it should start Ghost, you should press  &lt;code&gt;Y&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Running sudo command: /var/www/ghost/current/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current
✔ Running database migrations
? Do you want to start Ghost? Yes
Running sudo command: systemctl is-active ghost_example-com
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
Running sudo command: systemctl is-active ghost_example-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
Running sudo command: systemctl start ghost_example-com
✔ Starting Ghost
Running sudo command: systemctl is-enabled ghost_example-com
Running sudo command: systemctl enable ghost_example-com --quiet
✔ Starting Ghost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Before enabling the configuration, we need to install the SSL certificate. The specific operation process is as follows:&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Apply for Domain Name (DV) SSL Certificate&lt;/strong&gt;
&lt;/h3&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Apply for entrance&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Enter the SSL certificate management console&lt;br&gt;
Click【Apply for Certificate】&lt;br&gt;
View the model of the domain name certificate applied for, and click [OK]&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;fill out the application&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Fill in the application domain name, such as qcloud.com, cloud.tencent.com, demo.test.qlcud.com.&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Manual DNS verification method&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The certificate supports receiving DNS verification by default, and the verification method can be viewed for details.&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Verify identity after submitting application&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;After the application is submitted successfully, the pop-up window prompts as follows, you need to go to the [Certificate Details Page] to obtain the CName record and add analysis:&lt;br&gt;
To obtain the CName record as shown in the Tips, you need to successfully add the resolution as soon as possible before it can be reviewed by the CA agency:&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Install the certificate&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Download the certificate as follows:&lt;br&gt;
 &lt;code&gt;cert.crt privkey.key&lt;/code&gt; copy&lt;br&gt;
We need to copy the certificate file that needs to be downloaded after the application is successful to  &lt;code&gt;nginx&lt;/code&gt; the directory in the configuration file  &lt;code&gt;certs&lt;/code&gt; . Here you need to switch to root privileges, use the following command to switch to the &lt;strong&gt;root&lt;/strong&gt; user.&lt;br&gt;
 &lt;code&gt;sudo su&lt;/code&gt; copy&lt;br&gt;
Next we find the  &lt;code&gt;nginx&lt;/code&gt; directory&lt;br&gt;
 &lt;code&gt;cd /etc/nginx/&lt;/code&gt; copy&lt;br&gt;
Next, create a directory for the SSL certificate, we name it &lt;code&gt;certs&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir certs
cd certs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Then copy the certificate you downloaded in Tencent Cloud to this directory, note that the name must be  &lt;code&gt;cert.crt&lt;/code&gt;   &lt;code&gt;privkey.key&lt;/code&gt; .&lt;br&gt;
Next please open  &lt;code&gt;ghost&lt;/code&gt; the configuration file in the directory&lt;br&gt;
 &lt;code&gt;nano /var/www/ghost/system/files/example.con.conf&lt;/code&gt; copy&lt;br&gt;
Add the following configuration&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssl_certificate /etc/ssl/certs/cert.crt;
ssl_certificate_key /etc/ssl/private/privkey.key;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
Next, restart the nginx service to use the Tencent Cloud certificate normally.&lt;br&gt;
 &lt;code&gt;service nginx restart&lt;/code&gt; copy&lt;br&gt;
Your Ghost blog is now installed and ready to use. You can  &lt;code&gt;http://example.com&lt;/code&gt; visit your blog at . Now let's create an account so you can create your first article.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 3. Create an account and configure your blog&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To log in and configure your blog, visit &lt;a href="http://example.com/login"&gt;http://example.com/login&lt;/a&gt;  . You will see the following page:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BQBlpO3W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/http-save/1221444/u5wpc0smeb.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BQBlpO3W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/http-save/1221444/u5wpc0smeb.png%3FimageView2/2/w/1620" alt="image" width="590" height="543"&gt;&lt;/a&gt;&lt;br&gt;
Press the " &lt;strong&gt;Create Account"&lt;/strong&gt; button to get started.&lt;br&gt;
You'll see the " &lt;strong&gt;Create Account"&lt;/strong&gt; page, which will let you set a blog title, as well as your name, email address, and password:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wc_yHuyB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/http-save/1221444/8yzd8anyhe.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wc_yHuyB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/http-save/1221444/8yzd8anyhe.png%3FimageView2/2/w/1620" alt="image" width="" height=""&gt;&lt;/a&gt;&lt;br&gt;
Fill in the details and press the " &lt;strong&gt;Final Step: Invite Your Team"&lt;/strong&gt; button.&lt;br&gt;
The wizard will ask you to enter another author's email address, but you can choose the link &lt;strong&gt;I'll do this **&lt;/strong&gt;later** at the bottom of the screen .&lt;br&gt;
You will then see a list of posts, called "Stories" in Ghost:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fgPnYk3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/http-save/1221444/ijntr6doyy.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fgPnYk3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/http-save/1221444/ijntr6doyy.png%3FimageView2/2/w/1620" alt="image" width="880" height="388"&gt;&lt;/a&gt;&lt;br&gt;
You can create new stories or manage other settings for your blog from the menu on the left.&lt;/p&gt;

</description>
      <category>tencentcloud</category>
      <category>cvm</category>
    </item>
    <item>
      <title>Play with the iPerf test of Tencent Cloud CVM</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:25:09 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/play-with-the-iperf-test-of-tencent-cloud-cvm-1b8i</link>
      <guid>https://dev.to/kunzhu0710/play-with-the-iperf-test-of-tencent-cloud-cvm-1b8i</guid>
      <description>&lt;p&gt;&lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_8"&gt;Cloud Virtual Machine (CVM)&lt;/a&gt; provides you with secure and flexible computing capabilities. You can enable CVM in the cloud in just minutes to meet your diverse computing needs. Through (CVM)[&lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_8"&gt;https://www.tencentcloud.com/products/cvm?from_social=dev_8&lt;/a&gt;], you can easily scale up or down your computing resources as your business needs change. Billed based on your actual resource consumption, CVM reduces your computing costs and simplifies IT-related OPS.&lt;/p&gt;

&lt;p&gt;When it comes to iPerf, everyone must know that it is a command used to test network performance. iPerf is an open source network performance testing tool developed by the University of Illinois. It can be used to test the performance of TCP or UDP connections between network nodes (including loopback), including bandwidth, jitter and packet loss rate, where jitter and packet loss rate are suitable for UDP testing, and bandwidth testing is suitable for TCP and UDP.&lt;br&gt;
Generally speaking, the bandwidth test adopts UDP mode test, because the limit bandwidth, path delay, and packet loss rate can be measured in UDP mode, and these test items will be printed out in the bandwidth test report. When testing, first use the theoretical bandwidth of the link as the data transmission rate to test, for example, the theoretical bandwidth of the link from the client to the &lt;a href="https://cloud.tencent.com/product/cvm?from_social=dev_8"&gt;server&lt;/a&gt; is 1000Mbps, first use -b 1000M to test, and then according to the test results (including Actual bandwidth, delay jitter and packet loss rate), and then use the actual bandwidth as the data transmission rate to test, you will find that the delay jitter and packet loss rate are much better than the first time, repeat the test several times, you can get a stable actual bandwidth.&lt;br&gt;
iPerf works based on the server-client mode. Therefore, to use iPerf to test bandwidth, you need to establish a server (for discarding traffic) and a client (for generating traffic). The iPerf server or client uses the same command, but the options to start the command are different.&lt;/p&gt;

&lt;h1&gt;
  
  
  Key Features of iPerf
&lt;/h1&gt;

&lt;h2&gt;
  
  
  TCP
&lt;/h2&gt;

&lt;p&gt;Measure network bandwidth&lt;br&gt;
Report size and observations of MSS/MTU values&lt;br&gt;
Support for TCP window values ​​via socket buffering&lt;br&gt;
Multithreading is supported when P threads or Win32 threads are available. Client and server support simultaneous multiple connections&lt;/p&gt;

&lt;h2&gt;
  
  
  UDP
&lt;/h2&gt;

&lt;p&gt;Clients can create UDP streams of specified bandwidth&lt;br&gt;
Measure packet loss&lt;br&gt;
Measurement delay&lt;br&gt;
Multicast support&lt;br&gt;
Multithreading is supported when P threads are available. Client and server support simultaneous multiple connections (does not support Windows)&lt;/p&gt;

&lt;h1&gt;
  
  
  iPerf installation
&lt;/h1&gt;

&lt;p&gt;To install IPerf, you can download it for different operating systems at &lt;a href="https://iperf.fr/iperf-download.php"&gt;https://iperf.fr/iperf-download.php&lt;/a&gt;. It is recommended to download the iPerf2 version. Since iPerf3 cannot support multi-process download, it is more troublesome to perform multi-process testing. The specific command can be modeled as follows:&lt;br&gt;
Enable multithreading on the server:&lt;br&gt;
 &lt;code&gt;iperf3 -s -p 5101&amp;amp;amp;; iperf3 -s -p 5102&amp;amp;amp;; iperf3 -s -p 5103 &amp;amp;amp;&lt;/code&gt; &lt;br&gt;
The client enables multithreading:&lt;br&gt;
 &lt;code&gt;iperf3 -c hostname -T s1 -p 5101 &amp;amp;amp;;&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iperf3 -c hostname -T s2 -p 5102 &amp;amp;amp;;&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iperf3 -c hostname -T s3 -p 5103 &amp;amp;amp;;&lt;/code&gt; &lt;br&gt;
It can be seen that iPerf3 multi-threading is actually opening multiple ports for testing, which is troublesome, so it is recommended to download iperf2.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For the windows version of iPerf, directly copy the decompressed iperf.exe and cygwin1.dll to the %systemroot% directory&lt;/li&gt;
&lt;li&gt;For the linux version of iPerf, please use the following command to install
rpm -ivh iperf-.rpm
# iPerf Startup Test&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The iPerf test requires that the server side and the client side execute commands respectively to start&lt;/p&gt;

&lt;h2&gt;
  
  
  Server
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;iperf -s -p [端口]&lt;/code&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  client
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;iperf -c [server IP]&lt;/code&gt; &lt;br&gt;
Note: iPerf tests the bandwidth of the TCP protocol by default. If you need to test the bandwidth of UDP, you need to add the -u option&lt;br&gt;
The following is a simple test example:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Bandwidth test for TCP:
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;iperf -s -p 3389&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iperf -c 10.104.17.84 -p 3389 -t 30 -i 1&lt;/code&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction of common indicators:
&lt;/h3&gt;

&lt;p&gt;-c: client mode, followed by server ip&lt;br&gt;
-p: followed by the port the server is listening on&lt;br&gt;
-i: Set the time interval for bandwidth reporting, in seconds&lt;br&gt;
-t: Set the duration of the test, the unit is seconds, the default is 10s if not set&lt;br&gt;
-w: Set the size of the tcp window, generally do not need to be set, the default can be&lt;/p&gt;

&lt;p&gt;To test multi-threaded TCP, add the -P parameter to the client to test the multi-threaded TCP performance&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2jCuweui--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/xj5fofuxpu.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2jCuweui--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/xj5fofuxpu.png%3FimageView2/2/w/1620" alt="image" width="" height=""&gt;&lt;/a&gt;Server and client for TCP bandwidth test&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Bandwidth test for UDP:
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;iperf -s -p 3389 -u&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iperf -c 10.104.17.84 -p 3389 -i 1 -u -b 2000M&lt;/code&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction of common indicators:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;-c: client mode, followed by server ip&lt;br&gt;
-p: followed by the port the server is listening on&lt;br&gt;
-i: Set the time interval for bandwidth reporting, in seconds&lt;br&gt;
-t: Set the duration of the test, the unit is seconds, the default is 10s if not set&lt;br&gt;
-b: Set the sending bandwidth of udp, in bit/s&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q6693JFg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/qnoyqacsa5.png%3FimageView2/2/w/1620" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q6693JFg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ask.qcloudimg.com/draft/1919442/qnoyqacsa5.png%3FimageView2/2/w/1620" alt="image" width="840" height="639"&gt;&lt;/a&gt;UDP bandwidth test on server and client&lt;/p&gt;

&lt;h1&gt;
  
  
  iPerf common options
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;command line options&lt;/th&gt;
&lt;th&gt;describe&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;-f, --format [bkmaBKMA]&lt;/td&gt;
&lt;td&gt;Formatted bandwidth number output. The supported formats are: 'b' = bits/sec 'B' = Bytes/sec 'k' = Kbits/sec 'K' = KBytes/sec 'm' = Mbits/sec 'M' = MBytes/sec 'g' = Gbits/sec 'G' = GBytes/sec 'a' = adaptive bits/sec 'A' = adaptive Bytes/sec The adaptive format is one of kilo- and mega-. Fields other than bandwidth are output as bytes, unless the output format is specified, the default parameter is a. Note: When calculating bytes, Kilo = 1024, Mega = 1024^2, Giga = 1024^3. Usually, in the network, Kilo = 1000, Mega = 1000^2, and Giga = 1000^3, so Iperf also calculates bits (bits) accordingly. If this bothers you, use the -f b parameter and do the math yourself.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-i, --interval #&lt;/td&gt;
&lt;td&gt;Set the time interval between each report, in seconds. If set to a non-zero value, the test report will be output at this interval. The default value is zero.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-l, --len #[KM]&lt;/td&gt;
&lt;td&gt;Sets the length of the read and write buffers. The default value of TCP mode is 8KB, and the default value of UDP mode is 1470 bytes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-m, --print_mss&lt;/td&gt;
&lt;td&gt;Output the TCP MSS value (supported via TCP_MAXSEG). The MSS value is generally 40 bytes smaller than the MTU value. Usually&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-p, --port #&lt;/td&gt;
&lt;td&gt;Set the port to be the same as the listening port on the server side. The default is port 5001, the same as ttcp.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-u, --udp&lt;/td&gt;
&lt;td&gt;Use the UDP method instead of the TCP method. See the -b option.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-w, --window #[KM]&lt;/td&gt;
&lt;td&gt;Set the socket buffer to the specified size. For TCP mode, this setting is the TCP window size. For UDP mode, this setting is the buffer size for accepting UDP packets, limiting the maximum value that can accept packets.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-B, --bind host&lt;/td&gt;
&lt;td&gt;One of several addresses bound to the host. For the client, this parameter sets the popup interface. For the server side, this parameter sets the push interface. This parameter is only used on hosts with multiple network interfaces. In Iperf's UDP mode, this parameter is used to bind and join a multicast group. Use a multicast address in the range 224.0.0.0 to 239.255.255.255. See the -T parameter.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-C, --compatibility&lt;/td&gt;
&lt;td&gt;Compatibility mode can be used when working with lower versions of Iperf. It is not necessary to use compatibility mode on both ends, but it is strongly recommended to use compatibility mode on both ends. In some cases, the use of certain data streams can cause server-side crashes in version 1.7 or cause unexpected connection attempts.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-M, --mss #[KM}&lt;/td&gt;
&lt;td&gt;Attempt to set the TCP maximum segment value with the TCP_MAXSEG option. The size of the MSS value is usually the TCP/IP header minus 40 bytes. In Ethernet, the MSS value is 1460 bytes (MTU 1500 bytes). Many operating systems do not support this option.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-N, --nodelay&lt;/td&gt;
&lt;td&gt;Set the TCP no delay option to disable Nagle's algorithm. Normally this option is disabled for interactive programs, such as telnet.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-V (from v1.6 or higher)&lt;/td&gt;
&lt;td&gt;Bind an IPv6 address.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server: $ iperf -s –V&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Client: $ iperf -c  -V&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Note: In 1.6.3 or later, specifying an IPv6 address does not require binding with the -B parameter, as in versions prior to 1.6. On most operating systems, an IPv4 client-mapped IPv4 address will be responded.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server-side dedicated options&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-s, --server&lt;/td&gt;
&lt;td&gt;Iperf server mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-D (v1.2 or later)&lt;/td&gt;
&lt;td&gt;Iperf runs as a background daemon under Unix platforms. Under the Win32 platform, Iperf will run as a service.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-R (v1.2 or later, Windows only)&lt;/td&gt;
&lt;td&gt;Uninstall the Iperf service (if it is running).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-o (v1.2 or later, Windows only)&lt;/td&gt;
&lt;td&gt;Redirect output to specified file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-c, --client host&lt;/td&gt;
&lt;td&gt;If Iperf is running in server mode and a host is specified with the -c parameter, then Iperf will only accept connections from the specified host. This parameter does not work in UDP mode.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-P, --parallel #&lt;/td&gt;
&lt;td&gt;The number of connections to keep before the server shuts down. The default is 0, which means connections are always accepted.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Client specific options&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-b, --bandwidth #[KM]&lt;/td&gt;
&lt;td&gt;Bandwidth used in UDP mode, in bits/sec. This option is related to the -u option. The default value is 1 Mbit/sec.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-c, --client host&lt;/td&gt;
&lt;td&gt;Run Iperf in client mode and connect to the specified Iperf server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-d, --dualtest&lt;/td&gt;
&lt;td&gt;Run dual test mode. This will reverse the connection from the server side to the client side, using the port specified in the -L parameter (or by default the port from which the client side connects to the server side). These are done immediately at the same time as the operation. If you want an interactive test, try the -r parameter.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-n, --num #[KM]&lt;/td&gt;
&lt;td&gt;The number of buffers to transmit. Normally, Iperf sends data every 10 seconds. The -n parameter crosses this limit, sending data of the specified length the specified number of times, regardless of how long the operation takes. See the -l and -t options.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-r, --tradeoff&lt;/td&gt;
&lt;td&gt;Reciprocating test mode. When the client-to-server test ends, the server connects back to the client through the port specified by the -l option (or the port that the client connects to the server by default). When the client connection is terminated, the reverse connection begins. If you need to test both ways at the same time, try the -d parameter.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-t, --time #&lt;/td&gt;
&lt;td&gt;Sets the total time for the transfer. Iperf repeatedly sends packets of the specified length within the specified time. The default is 10 seconds. See the -l and -n options.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-L, --listenport #&lt;/td&gt;
&lt;td&gt;Specifies the port used by the server to connect back to the client. By default, the port that the client connects to the server is used.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-P, --parallel #&lt;/td&gt;
&lt;td&gt;Threads. Specifies the number of threads to use between client and server. The default is 1 thread. This parameter needs to be used by both the client and the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-S, --tos #&lt;/td&gt;
&lt;td&gt;Type of service for outgoing packets. Many routers ignore the TOS field. You can specify this value using hexadecimal numbers starting with "0x", or octal or decimal numbers starting with "0".&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;For example, '0x10' in hexadecimal = '020' in octal = '16' in decimal. The TOS value of 1349 is:&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IPTOS_LOWDELAY minimize delay 0x10&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IPTOS_THROUGHPUT maximize throughput 0x08&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IPTOS_RELIABILITY maximize reliability 0x04&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IPTOS_LOWCOST minimize cost 0x02&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-T, --ttl #&lt;/td&gt;
&lt;td&gt;The TTL value of the outgoing multicast packet. This is essentially the number of hops the data takes through the router. The default is 1, link-local.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-F (from v1.2 or higher)&lt;/td&gt;
&lt;td&gt;Bandwidth is measured using a specific data stream, such as a specified file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$ iperf -c  -F &lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-I (from v1.2 or higher)&lt;/td&gt;
&lt;td&gt;As with -F, input data from standard input and output files.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Miscellaneous&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-h, --help&lt;/td&gt;
&lt;td&gt;Display the command line reference and exit.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-v, --version&lt;/td&gt;
&lt;td&gt;Display version information and build information and exit.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>tencentcloud</category>
      <category>cvm</category>
    </item>
    <item>
      <title>Tencent Cloud Cos Get File Operation Practice--Go SDK</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:23:45 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/tencent-cloud-cos-get-file-operation-practice-go-sdk-58b3</link>
      <guid>https://dev.to/kunzhu0710/tencent-cloud-cos-get-file-operation-practice-go-sdk-58b3</guid>
      <description>&lt;h2&gt;
  
  
  question
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.tencentcloud.com/products/cos?from_social=dev_7"&gt;Tencent Cloud's object storage&lt;/a&gt; can be regarded as an online KV, so I tried to use it because of the recent demand. I encountered some problems when using it, specifically  &lt;code&gt;cos.BucketGetOptions&lt;/code&gt; the use of Delimiter in .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Delimiter used in the &lt;a href="https://www.tencentcloud.com/products/cos?from_social=dev_7"&gt;list object is "/"&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The Delimiter used in the &lt;a href="https://www.tencentcloud.com/products/cos?from_social=dev_7"&gt;download object is ""&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;According to the official statement, delimiter means to list the objects in the current directory. When it is set to empty, it lists all objects. I don't know exactly what this all means, so I put it into practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practice and Code
&lt;/h2&gt;

&lt;p&gt;The code is similar to &lt;a href="https://www.challengefilter.com/posts/20220613_%25E8%2585%25BE%25E8%25AE%25AF%25E4%25BA%2591cos-go-sdk%25E4%25BD%25BF%25E7%2594%25A8%25E5%25AD%25A6%25E4%25B9%25A0/"&gt;Tencent's cos Go SDK to use and learn&lt;/a&gt; , and there should be no difficulty in itself.&lt;br&gt;
The code contains the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Environment Construction: Build a complex file environment by uploading files in batches, providing a basis for subsequent acquisition and download of files&lt;/li&gt;
&lt;li&gt;File download: Test whether the content of the file is as expected&lt;/li&gt;
&lt;li&gt;File batch download: test the effect of the delimiter option on the download&lt;/li&gt;
&lt;li&gt;file listing: test the effect of the delimiter option in file listing&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  environmental construction
&lt;/h3&gt;

&lt;p&gt;Use the following functions to construct the environment. Note: Tencent Cloud Object Storage is not a free service. Pay attention to the cost when using it. The file operations of the example in this article will theoretically not exceed the free limit, but please pay attention when modifying the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func main(){
    u, _ := url.Parse("https://wtytest-1252789333.cos.ap-guangzhou.myqcloud.com")
b := &amp;amp;amp;cos.BaseURL{BucketURL: u}
c := cos.NewClient(b, &amp;amp;amp;http.Client{
Transport: &amp;amp;amp;cos.AuthorizationTransport{
https://console.cloud.tencent.com/cam/capi
SecretID: "secretID",
SecretKey: "secret",

Transport: &amp;amp;amp;debug.DebugRequestTransport{
RequestHeader:  true,
RequestBody:    true,
ResponseHeader: true,
ResponseBody:   false,
},
},
})

uploadFileToCos(0, "", c)
}

func uploadFileToCos(depth int, prefix string, c *cos.Client) {
if depth &amp;gt; 5 {
return
}
for i := 0; i &amp;lt; 3; i++ {
s := rand.Intn(100)
filePath := prefix + "file" + strconv.Itoa(s)
err := uploadFileByName(filePath, "file"+strconv.Itoa(s), c)
if err != nil {
log_status(err)
}
}

for i := 0; i &amp;lt; 2; i++ {
s := rand.Intn(100)
filePrefix := prefix + "path" + strconv.Itoa(s) + "/"
uploadFileToCos(depth+1, filePrefix, c)
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;/p&gt;

&lt;h3&gt;
  
  
  file download
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
func getFileByName(name string, c *cos.Client) {
resp, err := c.Object.Get(context.Background(), name, nil)
log_status(err)
bs, _ := ioutil.ReadAll(resp.Body)
resp.Body.Close()
fmt.Println("content:", string(bs))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;/p&gt;

&lt;h3&gt;
  
  
  File batch download
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func main(){
const NoDelimiter = ""
const FolderDelimiter = "/"
const path1 = "path59/path33/path43/" 
    const path2 = "path59/path33/path43" 
getAllFileInPrefix(path1, NoDelimiter, c)
getAllFileInPrefix(path1, FolderDelimiter, c)
}

func getAllFileInPrefix(prefix string, delimiter string, c *cos.Client) {
totalFileCount := 0
isTruncated := true
marker := ""
count := 0
for isTruncated {
fmt.Printf("count:%d marker:%s isTruncated:%v", count, marker, isTruncated)
count++

opt := &amp;amp;amp;cos.BucketGetOptions{
Prefix:    prefix,
Marker:    marker,
Delimiter: delimiter,
}
v, _, err := c.Bucket.Get(context.Background(), opt)
if err != nil {
log_status(err)
return
}
for _, content := range v.Contents {
resp, err := c.Object.Get(context.Background(), content.Key, nil)
if err != nil {
log_status(err)
return
}
bs, _ := ioutil.ReadAll(resp.Body)
resp.Body.Close()
fmt.Printf("key:%s content:%s\n", content.Key, string(bs))
totalFileCount++
}
marker = v.NextMarker
isTruncated = v.IsTruncated
}
fmt.Println("total file count is ", totalFileCount, " with count:", count)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
When the prefix of the cos key has "/" at the end, 21 files can be obtained with NoDelimiter, and 3 files can be obtained with FolderDelimiter.&lt;br&gt;
When there is no "/" at the end of the prefix of the cos key, 21 files can be obtained with NoDelimiter, and 0 files can be obtained with FolderDelimiter.&lt;br&gt;
This shows that when the delimiter is "/", it can be understood as a folder mode, and the folder mode only works on the simulated folder (that is, there is a "/" at the end of the prefix).&lt;br&gt;
If delimiter is an empty string, it will try to match objects with the same prefix.&lt;/p&gt;
&lt;h3&gt;
  
  
  file list
&lt;/h3&gt;

&lt;p&gt;The file listing is somewhat similar to the logic at the beginning of the file download, but with the commonPrefix added. The test code is the same as before and will not be repeated here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func listAllFileInPrefix(prefix string, delimiter string, c *cos.Client) {
var marker string
opt := &amp;amp;amp;cos.BucketGetOptions{
Prefix:    prefix,
Delimiter: delimiter,
MaxKeys:   1000,
}
totalFileCount := 0
commonPrefixCount := 0
isTruncated := true
for isTruncated {
opt.Marker = marker
v, _, err := c.Bucket.Get(context.Background(), opt)
if err != nil {
fmt.Println(err)
break
}
for _, content := range v.Contents {
fmt.Printf("Object: %v\n", content.Key)
}
totalFileCount += len(v.Contents)

for _, commonPrefix := range v.CommonPrefixes {
fmt.Printf("CommonPrefixes: %v\n", commonPrefix)
}
commonPrefixCount += len(v.CommonPrefixes)
isTruncated = v.IsTruncated 
marker = v.NextMarker       
}
fmt.Println("total file count", totalFileCount, " commonPrefix:", commonPrefixCount)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;copy&lt;br&gt;
When the prefix of the cos key has "/" at the end, using NoDelimiter can get 21 files without truncating the path, and using FolderDelimiter can get 3 files and truncating 2 paths (two subdirectories under the current directory).&lt;br&gt;
When there is no "/" at the end of the prefix of the cos key, using NoDelimiter can get 21 files without truncating the path, and using FolderDelimiter can get 0 files, but truncating a path (  &lt;code&gt;path59/path33/path43/&lt;/code&gt; ).&lt;/p&gt;

&lt;h2&gt;
  
  
  Summarize
&lt;/h2&gt;

&lt;p&gt;The delimiter of object storage can enable folder mode to simulate folders in general operating systems, which is generally useful.&lt;/p&gt;

</description>
      <category>cos</category>
      <category>tencentcloud</category>
      <category>objectstorage</category>
    </item>
    <item>
      <title>How to deploy Caddy on Tencent Cloud CVM</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:22:00 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/how-to-deploy-caddy-on-tencent-cloud-cvm-8bi</link>
      <guid>https://dev.to/kunzhu0710/how-to-deploy-caddy-on-tencent-cloud-cvm-8bi</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_6"&gt;Cloud Virtual Machine (CVM)&lt;/a&gt; provides you with secure and flexible computing capabilities. You can enable CVM in the cloud in just minutes to meet your diverse computing needs. Through &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_6"&gt;CVM&lt;/a&gt;, you can easily scale up or down your computing resources as your business needs change. Billed based on your actual resource consumption, CVM reduces your computing costs and simplifies IT-related OPS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is an era of Web Server. Apache and nginx compete for excellence. In the pursuit of ultimate performance,  there is no highest, only higher. But this is also an era of pursuit of personalization. Some Web Servers do not squeeze the "Performance Improvement" single-plank bridge, but have their own positioning. Caddy is such an open source Web Server.&lt;br&gt;
Matt Holt, the author of Caddy, explained the goal of caddy in the caddy official website and FAQ as follows: Other Web Servers are designed for the Web, and Caddy is designed for humans. In terms of functional positioning, unlike nginx, which often acts as the front-end reverse proxy, caddy is committed to becoming an easy-to-use static file Web Server. It can be seen that Caddy focuses on ease of use and simple configuration. And thanks to the cross-platform features of Go, caddy easily supports three major platforms: Windows, Linux, and Mac. In the Caddy developer documentation, we can see that caddy can also run on Android (linux arm).&lt;br&gt;
Pay attention to caddy because caddy fills the gap of go in general web server (maybe there are others, but I don't know yet), and at the same time, web server in go also "responds" to the recent trend of de-C in Golang (in Go 1.5 C is gone!), even though the caddy author mentions that caddy is not targeted like nginx. But who knows in the future? Once Go performance is high enough, once caddy is stable enough, someone will naturally use it to replace nginx or apache2 in the production environment of some applications. An all-Go system also has advantages in deployment, operation and maintenance.&lt;br&gt;
A notable feature of Caddy is that HTTPS is enabled by default. It was the first web server to provide HTTPS features without additional configuration. The default certificate is valid for 3 months and can be automatically renewed after expiration, which greatly reduces the cost and convenience of enabling HTTPS for small and medium-sized websites. Caddy enables HTTPS by default by checking the domain name (checking the domain name and issuing the certificate via the ACME protocol), and redirecting HTTP requests to HTTPS. It issues certificates on demand during startup and automatically reissues during server use. Let's Encrypt is the default certificate authority, but the user can customize the ACME CA used, which is necessary when testing the configuration. Of course, users can also configure certificates by themselves.&lt;br&gt;
&lt;strong&gt;1. Install Caddy&lt;/strong&gt;&lt;br&gt;
This article provides a one-click installation of the Caddy script, which is simple and fast without the trivial installation method. Applicable operating systems are: CentOS/Debian/Ubuntu. The installation script can be downloaded on &lt;a href="https://github.com/suxin1110/CaddyInstall"&gt;GitHub&lt;/a&gt; .&lt;br&gt;
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/f1dd56a67632cac1e1a0be7fa9618de2-1024x355.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---hHU9EXZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/f1dd56a67632cac1e1a0be7fa9618de2-1024x355.png%3FimageMogr2/format/webp" alt="undefined" width="880" height="305"&gt;&lt;/a&gt;&lt;br&gt;
One-click installation of Caddy scriptsAfter downloading, run the script directly to perform one-click installation. &lt;code&gt;wget --no-check-certificate https://github.com/suxin1110/CaddyInstall/caddy_install.sh &amp;amp;amp;&amp;amp;amp; chmod +x caddy_install.sh &amp;amp;amp;&amp;amp;amp; ./caddy_install.sh&lt;/code&gt; &lt;br&gt;
Caddy uses the command: /usr/local/caddy/Caddyfile&lt;br&gt;
Log file: cat /tmp/caddy.log&lt;br&gt;
Instructions for use: service caddy start | stop | restart | status&lt;br&gt;
Or use: /etc/init.d/caddy start | stop | restart | status&lt;br&gt;
&lt;strong&gt;2. Configuration instructions&lt;/strong&gt;&lt;br&gt;
The file that Caddy needs to configure is Caddyfile, and the default path of this file is /usr/local/caddy/Caddyfile&lt;br&gt;
The Caddyfile always puts the website domain name on the first line:&lt;br&gt;
 &lt;code&gt;localhost:8080&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;gzip&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;log ../access.log&lt;/code&gt; &lt;br&gt;
Configure multisite with one Caddyfile, must use curly braces to enclose each site &lt;br&gt;
&lt;code&gt;mysite.com {&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;root /www/mysite.com&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;}&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;sub.mysite.com:443 {&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;root /www/sub.mysite.com&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;gzip&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;log ../access.log&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;}&lt;/code&gt; &lt;br&gt;
Caddy can also implement the reverse proxy function. Compared with the configuration of other Web Servers, the configuration of Caddyfile reverse proxy can be said to be outstanding, and it only needs one command to achieve&lt;br&gt;
 &lt;code&gt;mysite.com:8080 {&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;log ./mysite.log&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;proxy /a localhost:9091&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;proxy /bar localhost:9092&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;}&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Caddy supports load balancing configuration and supports three load balancing algorithms: random (random), least_conn (least connection) and round_robin (round-robin scheduling). Load balancing is also implemented through proxy middleware.&lt;br&gt;
 &lt;code&gt;localhost:8080 {&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;log ./mysite.log&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;proxy / localhost:9091 localhost:9093 {&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;policy round_robin&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;}&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;proxy /b localhost:9092 localhost:9094 {&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;policy least_conn&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;}&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;}&lt;/code&gt;&lt;/p&gt;

</description>
      <category>tencentcloud</category>
      <category>cvm</category>
      <category>caddy</category>
    </item>
    <item>
      <title>Playing with Tencent Cloud CVM: Port forwarding with iptables</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:20:35 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/playing-with-tencent-cloud-cvm-port-forwarding-with-iptables-3m6d</link>
      <guid>https://dev.to/kunzhu0710/playing-with-tencent-cloud-cvm-port-forwarding-with-iptables-3m6d</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article will teach you how to use iptables for port forwarding on &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_5"&gt;Tencent Cloud CVM&lt;/a&gt;, come and learn!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is NAT (Port Forwarding)&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;All data packets sent on the network have an original address and a destination address. NAT is a technology to modify the original address or destination address (or port) of the data packet.&lt;br&gt;
So why do we need to change the IP address? In the Internet, only data packets with public addresses can be transmitted, and data packets with private addresses cannot be transmitted. For example, when watching videos and browsing websites in a WIFI environment, the IP of the terminal (private address, the original addresses of all data packets sent from mobile phones, pads, and computers are basically private addresses). In order for data packets to be transmitted on the Internet, a public IP is required. Therefore, when accessing the Internet, the router will convert the source address of all data packets into the IP address of its WLAN port (this is the public network ip, generally the IP assigned by the ISP). This translation technology is NAT. When the accessed server returns data packets, the router will change the destination address of all data packets, from the IP address of its WLAN port, back to the IP address of the intranet. This will allow you to access the Internet. Therefore, NAT technology is widely used every day.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Port forwarding with iptables&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Enable the system forwarding function&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;vi /etc/sysctl.conf&lt;/code&gt; &lt;br&gt;
set net.ipv4.ip_forward=0&lt;br&gt;
Modify it to net.ipv4.ip_forward=1&lt;br&gt;
After editing sysctl, if you need to take effect immediately, you need to&lt;br&gt;
 &lt;code&gt;sysctl -p&lt;/code&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. Modify the iptables command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If the same port is forwarded, you can directly type the following two-hop command:&lt;br&gt;
 &lt;code&gt;iptables -t nat -A PREROUTING -p tcp --dport [port] -j DNAT --to-destination [IP]&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iptables -t nat -A PREROUTING -p udp --dport [port] -j DNAT --to-destination [IP]&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iptables -t nat -A POSTROUTING -p tcp -d [IP] --dport [port] -j SNAT --to-source [localIP]&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iptables -t nat -A POSTROUTING -p udp -d [targetIP] --dport [port] -j SNAT --to-source [localIP]&lt;/code&gt; &lt;br&gt;
If different ports are forwarded, you need to specify the destination port number and the local port number:&lt;br&gt;
 &lt;code&gt;iptables -t nat -A PREROUTING -p tcp -m tcp --dport [localport] -j DNAT --to-destination [targetIP]:[targetport]&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iptables -t nat -A PREROUTING -p udp -m udp --dport [localip] -j DNAT --to-destination [targetIP]:[targetport]&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iptables -t nat -A POSTROUTING -d [targetIP]/32 -p tcp -m tcp --dport [targetport] -j SNAT --to-source [localIP]&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;iptables -t nat -A POSTROUTING -d [targetIP]/32 -p udp -m udp --dport [targetport] -j SNAT --to-source [localIP]&lt;/code&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Save iptables and restart the configuration to take effect&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;service iptables save&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;service iptables restart&lt;/code&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. View iptables configuration&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;iptables -t nat -L&lt;/code&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Extension&lt;/strong&gt; :
&lt;/h2&gt;

&lt;p&gt;Multi-port forwarding scheme (forwarding the 50000~65535 of the local server to the 50000~65535 port of the target IP 1.1.1.1):&lt;br&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp –dport 50000:65535 -j DNAT –to-destination 1.1.1.1&lt;br&gt;
iptables -t nat -A PREROUTING -p udp -m udp –dport 50000:65535 -j DNAT –to-destination 1.1.1.1&lt;br&gt;
iptables -t nat -A POSTROUTING -d 1.1.1.1/32 -p tcp -m tcp –dport 50000:65535 -j SNAT –to-source [local server IP]&lt;br&gt;
iptables -t nat -A POSTROUTING -d 1.1.1.1/32 -p udp -m udp –dport 50000:65535 -j SNAT –to-source [local server IP]&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cloud Virtual Machine (CVM) provides you with secure and flexible computing capabilities. You can enable CVM in the cloud in just minutes to meet your diverse computing needs. Through CVM, you can easily scale up or down your computing resources as your business needs change. Billed based on your actual resource consumption, CVM reduces your computing costs and simplifies IT-related OPS. Did you learn it? Buy a &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_5"&gt;CVM&lt;/a&gt; and try it out! &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>tencentcloud</category>
      <category>iptables</category>
      <category>cvm</category>
    </item>
    <item>
      <title>How to install Tomcat on Tencent Cloud CVM</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:18:07 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/how-to-install-tomcat-on-tencent-cloud-cvm-dfe</link>
      <guid>https://dev.to/kunzhu0710/how-to-install-tomcat-on-tencent-cloud-cvm-dfe</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;introduce&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tomcat&lt;/strong&gt; is a servlet container developed by the Jakarta project under the Apache Software Foundation. According to the technical specifications provided by Sun Microsystems, Tomcat implements support for Servlet and JavaServer Page (JSP), and provides some unique functions as a Web server, such as Tomcat management and control platform, security domain management and Tomcat valve, etc. Since Tomcat itself also includes an &lt;a href="https://zh.wikipedia.org/wiki/HTTP"&gt;HTTP&lt;/a&gt;&lt;a href="https://zh.wikipedia.org/wiki/%E6%9C%8D%E5%8A%A1%E5%99%A8"&gt;server&lt;/a&gt; , it can also be regarded as a separate &lt;a href="https://zh.wikipedia.org/wiki/Web%E6%9C%8D%E5%8A%A1%E5%99%A8"&gt;Web server&lt;/a&gt; . If you develop Java applications, Tomcat is a quick and easy way to serve them in a complete server environment designed specifically for this purpose.&lt;br&gt;
In this tutorial, we will install Tomcat and do some basic configuration on a &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_1"&gt;Debian 7 VPS .&lt;/a&gt;To complete this tutorial, you must have a normal user with sudo privileges.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Install Apache Tomcat&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will install Tomcat and its related packages. These are included in the default Debian repositories.&lt;br&gt;
To get the base repository, we can update the sources list and then install the package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install tomcat7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all we need to do to get to the default Tomcat page. Our installation is not complete, but you can log in to your server's  &lt;code&gt;8080&lt;/code&gt; port to view the default Tomcat page in your browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your_domain_or_ip:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/ccad705958b857b9dc2459f3eb87f409.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ys1IQfx9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/ccad705958b857b9dc2459f3eb87f409.png%3FimageMogr2/format/webp" alt="undefined" width="872" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To take advantage of more of Tomcat's capabilities, we'll install some additional Tomcat packages.&lt;br&gt;
These will allow us to control Tomcat using the web interface. It will install some documentation and examples, which we can also view through the website interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo apt-get install tomcat7-admin tomcat7-examples tomcat7-docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;## &lt;strong&gt;Install Java Development Tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In order to develop Java applications on your server using Tomcat, you need to download and install a few things.&lt;br&gt;
The first thing we need to do is install a compatible Java Development Kit. We can install it with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo apt-get install default-jdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The version installed here is  &lt;code&gt;openjdk-6-jdk&lt;/code&gt; , at present, this version is the most stable version running on Debian&lt;br&gt;
The Tomcat documentation also recommends that you install Apache Ant, a build tool for Java applications. The Tomcat documentation also recommends that you install a version control system, here we recommend installing git:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo apt-get install ant git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;## &lt;strong&gt;Configure the Tomcat website&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before we can start using some of the features we installed, we need to configure our server with a user and password.&lt;br&gt;
Configuration is very simple. We need to edit a file called tomcat-users.xml. Open it with an editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo nano /etc/tomcat7/tomcat-users.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside, you'll find a bunch of annotation configuration files. In fact, the only uncommented part of the file is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;tomcat-users&amp;gt;
&amp;lt;/tomcat-users&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to define the user between these two lines. We will grant this user access to the web interface. The configuration is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;tomcat-users&amp;gt;
    &amp;lt;user username="admin" password="password" roles="manager-gui,admin-gui"/&amp;gt;
&amp;lt;/tomcat-users&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set username and password. Save and close the file when done.&lt;br&gt;
Restart Tomcat to implement the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo service tomcat7 restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;## &lt;strong&gt;Test the website interface&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once Tomcat is installed and user login is configured, the main page can be accessed by going to the server IP address or domain name ending in :8080 as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; your_domain_or_ip:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will see the same default Tomcat page you saw before:&lt;br&gt;
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/67b1b29c5e81dbfd8d48ac2223ef97b5.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--POsSIbgW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/67b1b29c5e81dbfd8d48ac2223ef97b5.png%3FimageMogr2/format/webp" alt="undefined" width="880" height="596"&gt;&lt;/a&gt;However, since we have already installed and configured the components, we have access to more functionality. You can access the Tomcat documentation in your browser by clicking the link shown on the page or by visiting this page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your_domain_or_ip:8080/docs


When you have questions about how to do something with Tomcat, check out the Q&amp;amp;amp;A on this page.
We also now have access to some different sample programs. These can be accessed via links on the same initial login page, or by visiting:
your_domain_or_ip:8080/examples
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/6b3f35ef0228f46249a8a775ebc1fd0c.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nvpxl_l1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/6b3f35ef0228f46249a8a775ebc1fd0c.png%3FimageMogr2/format/webp" alt="undefined" width="332" height="176"&gt;&lt;/a&gt;Clicking on these items gives us an idea of ​​how the different functions are implemented in this environment. The main functions you want to access are the &lt;strong&gt;manager webapp&lt;/strong&gt; and the &lt;strong&gt;host-manager webapp&lt;/strong&gt; .&lt;br&gt;
Again, you can access these from the initial login page, or visit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; your_domain_or_ip:8080/manager/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; your_domain_or_ip:8080/host-manager/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can manage Java applications at the first site. It allows you to easily start, stop, deploy and reload your application. It can also find the cause of memory leaks caused by running applications:&lt;br&gt;
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/bf5f8b1cdbdab6f0601394bc6b28c004.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pwez0nth--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/bf5f8b1cdbdab6f0601394bc6b28c004.png%3FimageMogr2/format/webp" alt="undefined" width="874" height="591"&gt;&lt;/a&gt;&lt;br&gt;
In another page, you can test, tune, and add virtual hosts to serve your application. This allows you to easily set up access to deployed applications:&lt;br&gt;
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/dcf4fd087b277a86c8a81e630c489512.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bBFeJwcy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/dcf4fd087b277a86c8a81e630c489512.png%3FimageMogr2/format/webp" alt="undefined" width="880" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;in conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Tomcat provides an excellent platform for controlling and serving Java applications in a website environment. You can easily deploy .war files and have them up and running in a fraction of the time. Did you learn it? Buy a &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_1"&gt;CVM&lt;/a&gt; and try it out! &lt;/p&gt;

</description>
      <category>tencentcloud</category>
      <category>tomcat</category>
    </item>
    <item>
      <title>How to use Tencent Cloud CVM for SSH reverse proxy</title>
      <dc:creator>kunzhu0710</dc:creator>
      <pubDate>Fri, 15 Jul 2022 03:15:19 +0000</pubDate>
      <link>https://dev.to/kunzhu0710/how-to-use-tencent-cloud-cvm-for-ssh-reverse-proxy-3a83</link>
      <guid>https://dev.to/kunzhu0710/how-to-use-tencent-cloud-cvm-for-ssh-reverse-proxy-3a83</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;How to use CVM for SSH reverse proxy? This article will tell you the answer&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Scenario requirements&lt;/strong&gt;
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most of the company's internal test servers are placed on the company's intranet. Generally speaking, this access is one-way due to NAT. For example, we can access Baidu's server with the help of a computer or mobile phone, but Baidu's server cannot actively access our terminal. Since it can only be accessed through the company's intranet, employees cannot access it after returning home. The security is safe, but what if there is a demand that needs to be accessed from outside the company?&lt;br&gt;
Children's shoes who are more familiar with routers will say: "Just do port mapping and forwarding on the router." This solution does work, but there are 2 problems. First, you have to be able to control the router and make settings on it. Secondly, the broadband of the general company does not have a fixed IP, which means that the public network IP will change every 10-20 hours.&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;scene introduction&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;There is a server A in the company, the ip address is: 192.168.2.112, only devices on the same network segment within the company can access&lt;/li&gt;
&lt;li&gt;There is a &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_1"&gt;CVM&lt;/a&gt; with public IP on Tencent Cloud , the IP address is: 119.28.143.101, and everyone can use the key to log in.
At this time, if external personnel need to access server A, under normal circumstances, since the company's network exit uses NAT, IT will not open the port forwarding authority, so it cannot be accessed. However, by using SSH port forwarding, it is easy for external personnel to access the internal server. The specific commands are as follows:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ssh -fNR 222:localhost:22 root@119.28.143.101
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Another point is very important, you need to open a configuration for ssh on the server 119.28.143.101 (usually in the /etc/ssh/sshd_config file in linux systems):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; GatewayPorts yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The meaning of this command is to forward the 222 port request to the CVM to the 22 port of server A, so that we ssh -p 222 119.28.143.101 is equivalent to accessing ssh 192.168.2.112 22 port, of course, you can also forward other ports, such as Common 3389, 22, 21 and other ports.&lt;br&gt;
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/de06896ea06b11a042b4e67bb9aef321.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5V0f8wpS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/de06896ea06b11a042b4e67bb9aef321.png%3FimageMogr2/format/webp" alt="undefined" width="646" height="153"&gt;&lt;/a&gt;&lt;br&gt;
Telnet 119.28.143.101 port 22 on any computer&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Local forwarding and dynamic forwarding&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;The method mentioned above is also called SSH port remote forwarding. There is also a corresponding method called local forwarding. The command is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; `ssh -fNL 8080:119.28.143.101:80 root@192.168.2.112` 
 `-f Ask to go to the background before executing a command. It is used when preparing to ask for a password or passphrase, but the user wants it to be done in the background. This option implies the -n option. The recommended way to start an X11 program on a remote machine is something like ssh -f host xterm command` 
 `-N Does not execute remote commands. Used to forward ports. (Protocol version 2 only)` 
 `-L port:host:hostport Forward a port of the local machine (client) to the designated port of the remote designated machine. The working principle is this, a socket listening port port is allocated on the local machine, and once there is a connection on this port, the connection will be Forwarded through a secure channel, and the remote host establishes a connection with the host's hostport port. Port forwarding can be specified in the configuration file. Only root can forward privileged ports. IPv6 addresses are specified in another format: port/host/hostport` 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above command forwards the request for the local port 8080 to port 80 of 119.28.143.101. At this time, accessing &lt;a href="http://127.0.0.1:8080"&gt;http://127.0.0.1:8080&lt;/a&gt; is equivalent to accessing &lt;a href="http://119.28.143.101:80"&gt;http://119.28.143.101:80&lt;/a&gt;. For example, the company has two servers, which can be interconnected. One of the servers can access the Internet, but the other server is restricted from accessing the public network. At this time, this command can be used to "visit foreign websites".&lt;br&gt;
There is another way called dynamic forwarding, the command is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ssh -D 50000 root@119.28.143.101
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method is actually equivalent to a socks proxy. It forwards all local requests to the remote server, which is very practical. If the remote server is abroad, foreign proxy access can be achieved.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Remote intranet Windows server&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;The above explains how to forward a Linux server with only an internal network through the SSH port. The following will introduce how to forward it to a Windows machine that only has an internal network and relies on NAT to access the external network.&lt;br&gt;
Windows forwarding requires the help of the PuTTY tool, which has a simple and friendly interface and is easy to operate. The detailed environment information is as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Windows intranet machine A, IP address: 192.168.2.110, this machine is to access the Internet through NAT.&lt;/li&gt;
&lt;li&gt;There is a Linux CVM with public IP in Tencent Cloud, IP address: 119.29.14.248
Open PuTTY on machine A, and enter the IP address and corresponding port of the CVM public network.
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/c6fc5f3425ab64e8320344d199ce70f6.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vAc-gKlr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/c6fc5f3425ab64e8320344d199ce70f6.png%3FimageMogr2/format/webp" alt="undefined" width="770" height="729"&gt;&lt;/a&gt;Enter the public network address and port of the CVM
Configure the remote port and the local IP and port that need to be mapped in Connection-SSH-Auth-Tunnels in PuTTY, and click the Add button to add it to the PuTTY configuration.
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/3002280a8a2b33a1a295a653caf5d9fd.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8LqRNIxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/3002280a8a2b33a1a295a653caf5d9fd.png%3FimageMogr2/format/webp" alt="undefined" width="759" height="733"&gt;&lt;/a&gt;Tunnels configuration introduction
Click open, enter the account and password to log in (the account and password of the CVM server)
Check the monitor on CVM, you can see that there are already 8080 monitors
&lt;a href="https://cdn.computeinit.com/wp-content/uploads/2021/05/49f3aa21be2b9f9b17e212cfda117eaa-1024x58.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ybsr9ecp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.computeinit.com/wp-content/uploads/2021/05/49f3aa21be2b9f9b17e212cfda117eaa-1024x58.png%3FimageMogr2/format/webp" alt="undefined" width="" height=""&gt;&lt;/a&gt;I see that there is already port 8080 listening on CVM
If you need to use RDP to log in to the Windows server, because Windows cannot log in to itself, the above method to remotely log in to Windows requires the help of a third server for intranet forwarding.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Cloud Virtual Machine (CVM) provides you with secure and flexible computing capabilities. You can enable CVM in the cloud in just minutes to meet your diverse computing needs. Through CVM, you can easily scale up or down your computing resources as your business needs change. Billed based on your actual resource consumption, CVM reduces your computing costs and simplifies IT-related OPS. Did you learn it? Buy a &lt;a href="https://www.tencentcloud.com/products/cvm?from_social=dev_1"&gt;CVM&lt;/a&gt; and try it out! &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
