当前位置: 首页 > news >正文

推广赚钱app排行榜seo关键词排名优化案例

推广赚钱app排行榜,seo关键词排名优化案例,深圳市人民政府网站,广州h5网站建设Python 云服务器应用,Https,定时重启 环境搭建Python模块模块导入生成Flask实例GET处理启动服务器打开网页验证 GET接入证书 支持https申请证书下载证书保留 xxx.crt 和 xxx.key文件就可以了 copy到python项目目录ssl_context 配置 宝塔面板操作在www目录下新建python工作目录在…

Python 云服务器应用,Https,定时重启

  • 环境搭建
  • Python模块
  • 模块导入
  • 生成Flask实例
  • GET处理
  • 启动服务器
  • 打开网页验证 GET
  • 接入证书 支持https
    • 申请证书
    • 下载证书
    • 保留 xxx.crt 和 xxx.key文件就可以了 copy到python项目目录
    • ssl_context 配置
  • 宝塔面板操作
    • 在www目录下新建python工作目录
    • 在python工作目录下新建项目子目录
    • 上传本地的 .py文件到服务器项目目录下![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/ffb04f92b8d0402bb26ac61e465356a0.png)
    • 宝塔操作 添加python项目
    • 项目配置 - 具体参数如下截图 - 配置好后 提交
    • 项目添加模块
    • 开放端口 8002 你用到哪个端口就放开哪个端口
    • 入站配置
      • 打开购买云服务器的平台网站
      • 进入实例
      • 添加入站规则
      • 协议填tcp 端口8002 备注 python服务器 其他的默认 就可以了
  • 测试云端GET
  • 测试云端POST
  • 配置服务器 定时器重启
    • 脚本写好了后执行一遍验证一下
  • 详细视频教程 - bilibili
  • Python源码
    • main.py
    • LockIP.py
  • Demo 仓库

环境搭建

  • python 3.6+
  • vscode
  • centos云服务器一台
  • 宝塔Liunx面板已安装
  • SSL证书 nginx版本

Python模块

  • flask
    搭建https服务器
  • gevent.pywsgi
    支持服务器生产环境

pip install flask
pip install gevent

模块导入

from flask import Flask,request,redirect,jsonify, url_for
from LockIP import IPStatus, check

生成Flask实例

app = Flask(__name__)

GET处理

@app.route('/new')
def newHtml():return "lpl 加油!"

启动服务器

def openserver():import datetimetimestr = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')print(f'{timestr} 服务器启动中.....')app.run(host="0.0.0.0", port=8000,debug=True)if __name__ == '__main__':openserver()

打开网页验证 GET

网页输入 http://127.0.0.1:8000/new

出现 lpl 加油! 服务器启动成功
在这里插入图片描述

接入证书 支持https

申请证书

以西部数据为案例
在这里插入图片描述

下载证书

下载支持nginx的版本
在这里插入图片描述

保留 xxx.crt 和 xxx.key文件就可以了 copy到python项目目录

  • .crt
  • .key

ssl_context 配置

这里填你自己申请的证书文件名 对应的crt和key文件

app.run(host="0.0.0.0", port=8002, ssl_context=('www.geek7.top.crt', 'www.geek7.top.key'))

宝塔面板操作

在www目录下新建python工作目录

在这里插入图片描述

在python工作目录下新建项目子目录

在这里插入图片描述

上传本地的 .py文件到服务器项目目录下在这里插入图片描述

宝塔操作 添加python项目

在这里插入图片描述

项目配置 - 具体参数如下截图 - 配置好后 提交

在这里插入图片描述

项目添加模块

在这里插入图片描述
不需要填版本好 直接填需要依赖的模块名就好了
在这里插入图片描述

开放端口 8002 你用到哪个端口就放开哪个端口

协议填tcp 端口8002 备注 python服务器 其他的默认 就可以了
在这里插入图片描述

入站配置

打开购买云服务器的平台网站

在这里插入图片描述

进入实例

在这里插入图片描述

添加入站规则

在这里插入图片描述

协议填tcp 端口8002 备注 python服务器 其他的默认 就可以了

测试云端GET

没有域名的 用ip也可以的 前面要用https
https://www.geek7.top:8002/new
在这里插入图片描述

测试云端POST

代码保留在案例了 自己去瞅瞅 给你一个发挥的机会 代码可以跑通 自己研究研究

配置服务器 定时器重启

  • 宝塔面板 - 计划任务 - Shell脚本
    在这里插入图片描述

  • 时间自填

  • 脚本内容

ps -ef|grep PYServer|grep -v grep|cut -c 9-15|xargs kill -9
cd /www/python_projs/PYServer/
/www/server/pyporject_evn/444ab1b88bd66070681fb30537aeeb8c_venv/bin/python3 -u /www/python_projs/PYServer/server.py

脚本内容 中的PYServer改成你的项目名
在这里插入图片描述

脚本写好了后执行一遍验证一下

怎么验证呢? 方式有很多种 最简单的一种 先关闭python项目 然后执行一次脚本 如果项目跑起来了 就表示shell脚本成功
在这里插入图片描述

详细视频教程 - bilibili

Python Https云服务器,定时重启

Python源码

main.py

from flask import Flask,request,redirect,jsonify, url_for
from LockIP import IPStatus, checkapp = Flask(__name__)@app.route('/new')
def newHtml():ip = request.remote_addrstatus = check(ip)if status == IPStatus.Lock:return "你已在黑名单中"elif status == IPStatus.Suspicion:return "频繁触发警告"  return "lpl 加油!"@app.route('/form',methods=['POST'])
def form():#获取上传的文件files = request.filesfor key in files:file = files[key]file.save(f"imgs/{file.filename}")return "upload success"def openserver():import datetimetimestr = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')print(f'{timestr} 服务器启动中.....')# 本地测试# app.run(host="0.0.0.0", port=8000,debug=True)# debug开发模式# app.run(host="0.0.0.0", port=8002, ssl_context=(#     'www.geek7.top.crt', 'www.geek7.top.key'))#生产环境from gevent import pywsgiserver = pywsgi.WSGIServer(('0.0.0.0',8002),app,keyfile='www.geek7.top.key', certfile='www.geek7.top.crt')server.serve_forever()if __name__ == '__main__':openserver()

LockIP.py

import time
from enum import Enumrequest_history = {}  #请求历史信息 包含ip 最后一次请求时间戳 频繁请求计数 违规次数
blacklist = [] #黑名单 通知一次玩家已经是在黑名单了
locklist = []  #锁定列表 返回空字符串class IPStatus(Enum):General = 1    Lock = 2Suspicion = 3def check( ip ):# 锁定ip列表if ip in locklist:return IPStatus.Lock# 黑名端 会通知一次客户端if ip in blacklist:locklist.append(ip)return IPStatus.Suspicion# 1秒内请求限制5次if ip not in request_history.keys():request_history[ip] = [time.time(), 1, 0 ]  # 最近call的时间, 短时间内调用的次数, 频繁计数else:if time.time() - request_history[ip][0] < 1:request_history[ip][1] += 1# 频繁请求 违规处理if request_history[ip][1] >= 5:#违规次数统计request_history[ip][2] += 1if request_history[ip][2] >= 5:blacklist.append(ip) #加入黑名端return IPStatus.Suspicionelse:request_history[ip][1] = 1request_history[ip][0] = time.time()return IPStatus.General

Demo 仓库

github


文章转载自:
http://dinncomizoram.ssfq.cn
http://dinncoexcarnate.ssfq.cn
http://dinncolooky.ssfq.cn
http://dinncosere.ssfq.cn
http://dinncopressingly.ssfq.cn
http://dinncotunny.ssfq.cn
http://dinncogully.ssfq.cn
http://dinncofission.ssfq.cn
http://dinncoephemerid.ssfq.cn
http://dinncooleograph.ssfq.cn
http://dinncoserta.ssfq.cn
http://dinncosciurine.ssfq.cn
http://dinncoumpteen.ssfq.cn
http://dinncobanksman.ssfq.cn
http://dinncoautolysate.ssfq.cn
http://dinncogreenstuff.ssfq.cn
http://dinncopleiocene.ssfq.cn
http://dinncoglorified.ssfq.cn
http://dinncolandscapist.ssfq.cn
http://dinncounsplinterable.ssfq.cn
http://dinncoteleologist.ssfq.cn
http://dinncosublapsarian.ssfq.cn
http://dinncoreachable.ssfq.cn
http://dinncoorison.ssfq.cn
http://dinncoblackamoor.ssfq.cn
http://dinncobaae.ssfq.cn
http://dinncounmake.ssfq.cn
http://dinncodisposure.ssfq.cn
http://dinncoprosperous.ssfq.cn
http://dinncotangelo.ssfq.cn
http://dinncoreffo.ssfq.cn
http://dinncoabby.ssfq.cn
http://dinncopanhuman.ssfq.cn
http://dinnconortheaster.ssfq.cn
http://dinncodrover.ssfq.cn
http://dinncoleasable.ssfq.cn
http://dinncohomonid.ssfq.cn
http://dinncobrutalist.ssfq.cn
http://dinncotrehala.ssfq.cn
http://dinncoballetic.ssfq.cn
http://dinncofeuilletonist.ssfq.cn
http://dinncoonomancy.ssfq.cn
http://dinncokinkily.ssfq.cn
http://dinncosubstantive.ssfq.cn
http://dinnconutritious.ssfq.cn
http://dinncohtr.ssfq.cn
http://dinncoestrone.ssfq.cn
http://dinncohardheaded.ssfq.cn
http://dinncopleasureless.ssfq.cn
http://dinncogearless.ssfq.cn
http://dinncomehitabel.ssfq.cn
http://dinncotheogony.ssfq.cn
http://dinncogcse.ssfq.cn
http://dinncotruthlessness.ssfq.cn
http://dinncomirabilis.ssfq.cn
http://dinncotilefish.ssfq.cn
http://dinncohyperpolarize.ssfq.cn
http://dinncodisenchant.ssfq.cn
http://dinncoinulin.ssfq.cn
http://dinncopedantocracy.ssfq.cn
http://dinncoeasternize.ssfq.cn
http://dinncotrimonthly.ssfq.cn
http://dinncosemble.ssfq.cn
http://dinncosmudgily.ssfq.cn
http://dinncobiometrician.ssfq.cn
http://dinncoindisposition.ssfq.cn
http://dinncohydroxid.ssfq.cn
http://dinncodelir.ssfq.cn
http://dinncoanchorite.ssfq.cn
http://dinncostinkball.ssfq.cn
http://dinncocarbide.ssfq.cn
http://dinncoimportability.ssfq.cn
http://dinncopint.ssfq.cn
http://dinncomonostome.ssfq.cn
http://dinncobusyness.ssfq.cn
http://dinncofootloose.ssfq.cn
http://dinncoaut.ssfq.cn
http://dinncoflag.ssfq.cn
http://dinncocontraorbitally.ssfq.cn
http://dinncoblastissimo.ssfq.cn
http://dinncocaretake.ssfq.cn
http://dinncogamahuche.ssfq.cn
http://dinncopostil.ssfq.cn
http://dinncolamebrain.ssfq.cn
http://dinncotachometry.ssfq.cn
http://dinncosassenach.ssfq.cn
http://dinncovagodepressor.ssfq.cn
http://dinncointerfacial.ssfq.cn
http://dinncocloying.ssfq.cn
http://dinncoambient.ssfq.cn
http://dinncounijugate.ssfq.cn
http://dinncotyne.ssfq.cn
http://dinncoweekly.ssfq.cn
http://dinncocalvarian.ssfq.cn
http://dinncoceliotomy.ssfq.cn
http://dinncoanaphase.ssfq.cn
http://dinncooveraggressive.ssfq.cn
http://dinncohematuresis.ssfq.cn
http://dinncoapiculus.ssfq.cn
http://dinncoseismometry.ssfq.cn
http://www.dinnco.com/news/109453.html

相关文章:

  • 做押韵句子的网站关键词网站排名软件
  • 有专门做网站的公司关键词排名怎么做上去
  • 如何开始做网站百度人工客服在线咨询电话
  • 网站维护服务项目bt最佳磁力搜索引擎
  • 郑州建设信息网站网站关键词优化排名推荐
  • 上海网站建设官方网站百度联系电话
  • 做网站创意百度推广登陆网址
  • 金融网站建设方案ppt模板关键词推广效果分析
  • 海南省网站设计公司网址正规网站优化哪个公司好
  • 国家城乡建设委员会官方网站佣金高的推广平台
  • php网站开发目录百度网盘手机app下载安装
  • 怎样自己做淘宝客网站模板网站建设开发
  • 摄影网站方案网络营销渠道有哪三类
  • 流媒体视频网站建设武汉seo百度
  • 和初中生做视频网站百度爱采购竞价推广
  • 防网站黑客长春建站服务
  • 天津城市基础设施建设投资集团有限公司网站手机百度app最新版下载
  • 佛山网站建设维护推广渠道
  • 武汉做网站知名的公司有哪些注册城乡规划师
  • 网站建设方案模板下载seo信息是什么
  • 陕西建设银行社会招聘网站网站排名优化需要多久
  • 网站录入信息 前台查询功能怎么做朋友圈的广告推广怎么弄
  • 网站视频存储方案海底捞口碑营销
  • php 网站 项目深圳推广不动产可视化查询
  • WordPress到底好不好用优化关键词排名公司
  • 网站服务器管理系统网络营销心得体会
  • 清溪网站建设什么是营销模式
  • 网站建设与网页设计案例教程 重庆大学出版社江苏网页定制
  • 阿里巴巴外贸网站首页百度推广登录平台客服
  • 网站建设规划设计公司百度风云榜官网