VM <<
Previous Next >> Proxmox VE
Virtualbox
https://www.virtualbox.org/
cmsimde 網際內容管理系統的啟動分為開發模式 (development) 與生產模式 (production):
開發模式: 在 Windows, 使用 cms.bat 或在 Linux 使用 ./cms
生產模式(以較高的運行效率部署):
中小型應用 WSGI (每秒約 350 ~ 500 請求): python waitress_server.py
中型應用 WSGI Gunicorn (Green Unicorn) (每秒約 800 ~ 1200 請求): python gunicorn_server.py
大型應用 uWSGI (每秒約 1500 ~2500 請求): python uwsgi_server.py
waitress_server.py
# pip install waitress
from waitress import serve
from cmsimde import flaskapp
# 8xxxx is for Stunnel accept port
# 9xxxx is for localhost internal port
serve(flaskapp.app, listen='127.0.0.1:9443', threads=8)
gunicorn_server.py
# pip install gunicorn
import subprocess
# Gunicorn 啟動命令
command = [
'gunicorn',
'-b', '127.0.0.1:9443', # 內部端口
'-w', '4', # 啟動 4 個工作進程
'cmsimde.flaskapp:app' # 指定 Flask 應用模組的路徑
]
# 啟動 Gunicorn
subprocess.run(command)
uwsgi_server.py
# pip install uwsgi
import subprocess
# uWSGI 啟動命令
command = [
'uwsgi',
'--http', '127.0.0.1:9443', # uWSGI 綁定的內部端口
'--wsgi-file', 'cmsimde/flaskapp.py', # 指定 Flask 應用的 Python 文件
'--callable', 'app', # 指定 Flask 實例的名稱
'--processes', '4', # 啟動 4 個工作進程
'--threads', '2' # 每個進程啟動 2 個線程
]
# 啟動 uWSGI
subprocess.run(command)
stunnel.conf
[https]
accept = server_name:443
connect = 127.0.0.1:9443
cert = /etc/stunnel/fullchain.pem
key = /etc/stunnel/privkey.pem
TIMEOUTClose = 0
VM <<
Previous Next >> Proxmox VE