- 1.python 基本的
- 2.nginx 後臺控制
- 3.uwgis 連接python 與 nginx 之間的溝通
- 4.dehydrated 處理ssl 的問題,因為linebot 需要https的服務才能
anaconda install .....please google
安裝flask
執行第一個案例
python 1_flask_hellow/hellow.py
在網頁中打開 127.0.0.1:5000
參考 ref:https://stackoverflow.com/questions/24912827/nginx-error-unknown-directive-uwsgi-param
sudo apt-get install nginx
sudo apt-get install uwsgi
sudo apt-get install uwsgi-plugin-python
conda install -c conda-forge uwsgi
conda install -c conda-forge libiconv
ref:http://blog.changyy.org/2018/06/python-line-chatbot-echo-service-ubuntu.html
2_flask_uwgis 相關設定
sudo vi /etc/systemd/system/chatbot.uwsgi.service
配合myproject.ini的設定使用
相關錯誤訊息請看 裡面有相關資訊
ls /var/log/uwsgi/
sudo vi /etc/nginx/sites-available/default
修改裡面的資訊後重啟服務
service nginx restart
相關錯誤訊息請看 裡面有相關資訊
sudo vi /var/log/nginx/error.log
Let’s Encrypt SSL 申請
Ref: https://wiki.gslin.org/wiki/Dehydrated
Ref: https://blog.wu-boy.com/2016/10/website-support-http2-using-letsencrypt/
sudo add-apt-repository ppa:gslin/dehydrated-lite
sudo apt update
sudo apt install dehydrated-lite
echo "WELLKNOWN=/var/www/dehydrated" > /etc/dehydrated/config
sudo mkdir /etc/dehydrated
sudo touch /etc/dehydrated/config
sudo mkdir /var/www/dehydrated
cd /etc/dehydrated/
wget https://raw.githubusercontent.com/lukas2511/dehydrated/master/dehydrated -O /
chmod 755 /etc/dehydrated/dehydrated
location /.well-known/acme-challenge/ {
alias /var/www/dehydrated/;
}
cd /etc/dehydrated
echo 'blog.gslin.org' | sudo tee -a domains.txt
sudo dehydrated --register --accept-terms
/etc/dehydrated/dehydrated -c -d fbbot.wu-boy.com
官方的 Ref: https://github.com/line/line-bot-sdk-python#imagesendmessage 參考這位寫的真的很強了 Ref: https://github.com/twtrubiks/line-bot-tutorial Ref: https://github.com/twtrubiks/line-bot-imgur-tutorial