Quick configuration after purchasing Tencent Cloud host

version

Related Information select
Ubuntu 18.10
Virtual environment virtualenv
IP 49.235.108.13 (Tencent Cloud)
domain name academics.work (Tencent Cloud)
Ministry of Industry and Information Technology record/license number Zhejiang ICP No. 2020035646
Date of approval 2020-09-27
Public security organ record number 33021102000741
Public security filing link format

http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=33021102000741

That is to pass in your parameters to the recordcode

Public security logo Just copy the public security logo link of csdn and use it on your own html page.

 

 

 

Remote file transfer command

File transfer direction Specific command
Local -> Cloud Host scp -r homepage/ [email protected]:/home/appleyuchi
Cloud host -> local scp -r [email protected]:/home/appleyuchi ~/桌面

 

SCP free input password configuration

ssh-copy-id [email protected]

 

View information location

Related questions/information Where to check/solve
domain name WeChat-Tencent Cloud Assistant

SSL certificate audit notice

WeChat-Tencent Cloud Assistant
Real-name domain name notification WeChat-Tencent Cloud Assistant
Real-name authentication information has not been verified https://console.cloud.tencent.com/cns
Server ip and password

https://console.cloud.tencent.com/

Station letter

After the first login, the system is brand new, so there is no root password, you need to re-set it with the following commands

sudo passwd

 

Tencent's pip mirror

[global]
index-url = http://mirrors.tencentyun.com/pypi/simple
trusted-host = mirrors.tencentyun.com

After creating a new user, you need to add the above mirror dependency in ~/.pip/pip.conf.

 

Tencent's apt mirror

/etc/apt/sources.list

deb http://mirrors.tencentyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.tencentyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.tencentyun.com/ubuntu/ bionic-updates main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ bionic-updates main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ bionic-backports main restricted universe multiverse

 

Don't install anaconda3, it will occupy 10 gigabytes

apt install expect nginx

Go all over [1][2][3]

 

Cloud host test

python3 hello.py

from flask import Flask

app=Flask(__name__) 
@app.route('/')      #相当于一个装饰器,视图映射,路由系统生成 视图对应url,这边没有指定method .默认使用get
def first_flask():    #视图函数
    return 'Hello World'  #response,最终给浏览器返回的内容
if __name__ == '__main__':
    app.run(host="0.0.0.0",port=10071,debug=True)

Then open the web page

http://49.235.108.13:10071/

See if there is hello world

 

SSL certificate application

The certificate application is carried out in Dnspod, and the filling method is as follows:

 

Domain name and ip binding

 

Then click on the domain name in the picture above, enter the picture below and fill in the IP

If the above operation is successful, you can ping through at this time

 

Nginx configuration

user  root;
worker_processes  2;
error_log  /etc/nginx/error.log;
pid /etc/nginx/nginx.pid;
 
events {
    worker_connections 1024;
}
 
http {
    #include       /usr/local/nginx/conf/mime.types;
    include /etc/nginx/mime.types;
    default_type  application/octet-stream;
 
server {
    listen 80;
    server_name www.academics.work;
    access_log  /var/log/nginx/access.log;
proxy_set_header Host $host:$server_port;

    location / {
    
    proxy_pass http://127.0.0.1:10071;
    #proxy_set_header Host $host;
    proxy_set_header X-Real-IP   $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


    }

    
 
    location /work {
        root /home/appleyuchi;
        autoindex on;






    }
  }
  
}

nginx -c /etc/nginx/nginx.conf

nginx -s reload

 

Cloud server external network port

There are internal ports in the system and external ports, but internal ports are useless.

Click on the console link:
https://console.cloud.tencent.com/

Choose:
My Resources -> Cloud Server

 

Get the following:

 

Then select More -> Security Group -> Configure Security Group

Select sg-la8ed6p2 on the right

Finally, you can see that the external network port is fully open.

 

Reference:

[1] Use expect in xfce under Ubuntu16.04 to switch to root account without password input when su

[2] The usage of virtualenv in Ubuntu 18.10 (64 bit) (command and graphical creation of virtual environment)

[3] ubuntu environment next key switch python virtualenv virtual environment

Guess you like

Origin blog.csdn.net/appleyuchi/article/details/108681044