修改为https 服务器
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import requests
|
||||
import os
|
||||
from flask import Flask, jsonify, request, send_from_directory
|
||||
|
||||
app = Flask(__name__, static_folder='static')
|
||||
@@ -69,3 +70,20 @@ def change_cloth_base64():
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host="0.0.0.0", port=28889, debug=True)
|
||||
|
||||
# if __name__ == '__main__':
|
||||
# # 证书路径(替换为你的域名)
|
||||
# ssl_cert = '/etc/letsencrypt/live/change.xiangsilian.com/fullchain.pem'
|
||||
# ssl_key = '/etc/letsencrypt/live/change.xiangsilian.com/privkey.pem'
|
||||
|
||||
# # 检查证书文件是否存在
|
||||
# if not os.path.exists(ssl_cert) or not os.path.exists(ssl_key):
|
||||
# print("❌ 证书文件不存在,请检查路径是否正确!")
|
||||
# else:
|
||||
# # 启动HTTPS服务(443端口需要root权限,所以运行时要加sudo)
|
||||
# app.run(
|
||||
# host='0.0.0.0', # 允许外网访问
|
||||
# port=443, # HTTPS默认端口(非443需加端口访问,如8443)
|
||||
# ssl_context=(ssl_cert, ssl_key), # 加载Let's Encrypt证书
|
||||
# debug=True # 生产环境务必关闭debug
|
||||
# )
|
||||
|
||||
Reference in New Issue
Block a user