购买腾讯云主机后的快速配置
版本
| 相關(guān)信息 | 選擇 |
| Ubuntu | 18.10 |
| 虛擬環(huán)境 | virtualenv |
| IP | 49.235.108.13(騰訊云) |
| 域名 | academics.work(騰訊云) |
| 工信部備案/許可證編號(hào) | 浙ICP備2020035646號(hào) |
| 審核通過日期 | 2020-09-27 |
| 公安機(jī)關(guān)備案號(hào) | 33021102000741 |
| 公安備案鏈接格式 | http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=33021102000741 也就是往recordcode傳入你的參數(shù)即可 |
| 公安logo | 直接把csdn的公安logo鏈接拷貝后用到自己的html網(wǎng)頁即可 |
?
云主機(jī)開機(jī)/關(guān)機(jī)/重啟
控制臺(tái)->我的資源->云服務(wù)器->選擇下圖中右側(cè)的"更多"
?
?
遠(yuǎn)程傳遞文件命令
| 文件傳遞方向 | 具體命令 |
| 本地->云主機(jī) | scp -r homepage/ appleyuchi@49.235.108.13:/home/appleyuchi |
| 云主機(jī)->本地 | scp -r appleyuchi@49.235.108.13:/home/appleyuchi ~/桌面 |
?
SCP免輸入密碼配置
ssh-copy-id appleyuchi@49.235.108.13
?
SSH遠(yuǎn)程登錄方式
ssh appleyuchi@49.235.108.13
ssh appleyuchi@www.academics.work
?
查看信息位置
| 相關(guān)問題/信息 | 在哪里查看/解決 |
| 域名 | 微信-騰訊云助手 |
| SSL證書審核通知 | 微信-騰訊云助手 |
| 域名實(shí)名結(jié)果通知 | 微信-騰訊云助手 |
| 未核實(shí)到實(shí)名認(rèn)證信息 | https://console.cloud.tencent.com/cns |
| 服務(wù)器的ip和密碼 | https://console.cloud.tencent.com/ 站內(nèi)信 |
第一次登陸后,系統(tǒng)里面是全新的,所以沒有root密碼,需要自己重新用下列命令設(shè)置
sudo passwd
?
騰訊的pip鏡像
[global]
index-url = http://mirrors.tencentyun.com/pypi/simple
trusted-host = mirrors.tencentyun.com
新建用戶后,需要在~/.pip/pip.conf中增加上面的鏡像依賴.
?
騰訊的apt鏡像
/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?
不要安裝anaconda3,會(huì)占據(jù)10幾個(gè)G
apt install expect nginx
走遍[1][2][3]
?
云主機(jī)測(cè)試
python3 hello.py
from flask import Flaskapp=Flask(__name__) @app.route('/') #相當(dāng)于一個(gè)裝飾器,視圖映射,路由系統(tǒng)生成 視圖對(duì)應(yīng)url,這邊沒有指定method .默認(rèn)使用get def first_flask(): #視圖函數(shù)return 'Hello World' #response,最終給瀏覽器返回的內(nèi)容 if __name__ == '__main__':app.run(host="0.0.0.0",port=10071,debug=True)然后打開網(wǎng)頁
http://49.235.108.13:10071/
看下是否有hello world
?
SSL證書申請(qǐng)
證書申請(qǐng)?jiān)贒nspod中進(jìn)行,填寫辦法如下:
?
域名與ip綁定
?
然后點(diǎn)擊上圖中的域名,進(jìn)入下圖填寫IP即可
上述操作成功的話,這個(gè)時(shí)候可以ping通了
?
Nginx配置
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版本 | nginx命令 |
| 使用apt中的nginx | nginx -c /etc/nginx/nginx.conf nginx -s reload |
| 使用自己編譯的nginx | /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf /usr/local/nginx/sbin/nginx?-s reload |
?
?
云服務(wù)器外網(wǎng)端口
端口有系統(tǒng)內(nèi)端口和外網(wǎng)端口,光有內(nèi)網(wǎng)端口是沒有用的.
點(diǎn)擊控制臺(tái)鏈接:
https://console.cloud.tencent.com/
選擇:
我的資源->云服務(wù)器
?
得到如下:
?
然后上圖選擇 更多->安全組->配置安全組
選擇右側(cè)的sg-la8ed6p2
最后可以看到外網(wǎng)端口是全開的.
?
重啟服務(wù)器后迅速恢復(fù)一些工程
恢復(fù)簡(jiǎn)歷展示
cd homepage
nohup python hello.py &
disown -h %1
恢復(fù)獨(dú)立電商網(wǎng)站
fastdfs與nginx(第一部分)
# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ngx_http_fastdfs_set pid=18901
# /usr/local/nginx/sbin/nginx -s reload
主程序與異步隊(duì)列celery(第二部分)
$ cd ~/天天生鮮加強(qiáng)版-基本完成/Django2_dailyfresh-python3版本 -基本完成/
$ nohup python manage.py runserver 0.0.0.0:8000 &
$ disown -h %1
$ nohup celery -A celery_tasks.tasks worker -l info &
$ disown -h %1
恢復(fù)superset大數(shù)據(jù)可視化
nohup superset run -p 5000 -h 0.0.0.0 &
disown -h %1
?
Reference
[1]Ubuntu16.04下xfce中使用expect在su時(shí)免密碼輸入切換到root賬戶
[2]virtualenv在Ubuntu18.10(64位)中的用法(命令和圖形化建立虛擬環(huán)境)
[3]ubuntu環(huán)境下一鍵切換python的virtualenv虛擬環(huán)境
總結(jié)
以上是生活随笔為你收集整理的购买腾讯云主机后的快速配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 带雅字的微信昵称网名古典有诗意508个
- 下一篇: 寻找老同学