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

怎么用wordpress打开网站全国疫情排行榜最新情况列表

怎么用wordpress打开网站,全国疫情排行榜最新情况列表,网站建设了推广方案,psd免费素材网一、系统准备 我们的服务器采用了 openEuler 22.03 (LTS-SP4) 的初始化服务器模式安装 二、安装步骤 (一)安装依赖库 在终端中运行以下命令确保系统安装了必要的依赖: sudo dnf install -y python3上述 Python 脚本中的依赖库会在运行 Py…

一、系统准备

我们的服务器采用了 openEuler 22.03 (LTS-SP4) 的初始化服务器模式安装

二、安装步骤

(一)安装依赖库

  1. 在终端中运行以下命令确保系统安装了必要的依赖:
    sudo dnf install -y python3
    
    上述 Python 脚本中的依赖库会在运行 Python 脚本时自动安装(如果尚未安装的话)。其中 flask 库可以使用以下命令安装:
    pip3 install flask
    

(二)初始安装代码

以下代码用于执行系统的初始设置,包括更新系统、配置网络、安装 Nginx 和配置防火墙等操作。

vi   /var/www/html/initial_setup.py  

将以下代码,复制粘贴到文件中

import os
import subprocess
import redef run_command(command):"""执行命令并返回输出"""result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)if result.returncode!= 0:print(f"Error: {result.stderr}")exit(1)return result.stdoutdef update_system():"""更新系统到最新版本"""answer = input("Do you want to update the system? (yes/no): ")if answer.lower() == 'yes':print("Updating system...")run_command("dnf update -y")else:print("To update the system manually, run: dnf update -y")def configure_network():"""配置网络设置"""answer = input("Do you want to configure network settings? (yes/no): ")if answer.lower() == 'yes':# 获取所有网卡信息network_info = run_command("ip -o link show | awk -F': ' '{print $2}'")interfaces = [line.strip() for line in network_info.splitlines() if "lo" not in line]if len(interfaces) == 1:interface = interfaces[0]else:print("Multiple network interfaces detected. Please select one to set the IP address:")for i, iface in enumerate(interfaces, start=1):print(f"{i}. {iface}")choice = int(input("Enter the number of your choice: ")) - 1interface = interfaces[choice]# 设置 IP 地址print(f"Setting IP address for {interface} to 10.10.10.10/24...")run_command(f"nmcli con mod \"{interface}\" ipv4.addresses 10.10.10.10/24")run_command(f"nmcli con mod \"{interface}\" ipv4.gateway 10.10.10.2")run_command(f"nmcli con mod \"{interface}\" ipv4.dns 8.8.8.8")run_command(f"nmcli con up \"{interface}\"")else:print("To configure network settings manually:")print("1. Identify network interfaces using: ip -o link show | awk -F': ' '{print $2}'")print("2. Select an interface and set IP address, gateway and DNS using nmcli commands.")def install_nginx():"""安装 Nginx Web 服务器"""answer = input("Do you want to install Nginx? (yes/no): ")if answer.lower() == 'yes':print("Installing Nginx...")run_command("dnf install -y nginx")run_command("systemctl enable nginx")run_command("systemctl start nginx")else:print("To install Nginx manually:")print("1. Run: dnf install -y nginx")print("2. Enable and start Nginx using systemctl.")def configure_firewall():"""配置防火墙"""answer = input("Do you want to configure firewall? (yes/no): ")if answer.lower() == 'yes':print("Configuring firewall...")run_command("firewall-cmd --permanent --add-port=80/tcp")run_command("firewall-cmd --permanent --add-port=443/tcp")run_command("firewall-cmd --reload")else:print("To configure firewall manually:")print("1. Run: firewall-cmd --permanent --add-port=80/tcp")print("2. Run: firewall-cmd --permanent --add-port=443/tcp")print("3. Reload firewall using: firewall-cmd --reload")def setup_dns_and_hosts():"""设置 DNS 解析和修改 hosts 文件"""answer = input("Do you want to set up DNS and hosts file? (yes/no): ")if answer.lower() == 'yes':print("Setting up DNS and hosts file...")with open("/etc/hosts", "a") as f:f.write("\n10.10.10.10 www.cgqyw.com cgqyw.com\n")else:print("To set up DNS and hosts file manually:")print("Append the following line to /etc/hosts: 10.10.10.10 www.cgqyw.com cgqyw.com")def initial_setup():update_system()configure_network()install_nginx()configure_firewall()setup_dns_and_hosts()if __name__ == "__main__":initial_setup()

(三)安装文件上传服务

以下代码用于设置 Flask 文件上传服务,并创建默认的 Nginx 页面。

import os
from flask import Flask, render_template, request, send_from_directoryapp = Flask(__name__)
UPLOAD_FOLDER = '/var/www/html/uploads/'
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER# 确保上传文件夹存在
if not os.path.exists(UPLOAD_FOLDER):os.makedirs(UPLOAD_FOLDER)@app.route('/')
def index():# 显示所有已上传的文件列表files = os.listdir(app.config['UPLOAD_FOLDER'])return render_template('index.html', files=files)@app.route('/upload', methods=['POST'])
def upload_file():if 'file' not in request.files:return "No file part"file = request.files['file']if file.filename == '':return "No selected file"if file:filename = file.filenamefile.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))return "File uploaded successfully"@app.route('/download/<filename>')
def download_file(filename):return send_from_directory(app.config['UPLOAD_FOLDER'], filename, as_attachment=True)def setup_file_upload_service():default_html = """<!DOCTYPE html><html><head><title>Welcome to CGQYW</title></head><body><h1>Welcome to CGQYW Server!</h1><p>This is a simple web server.</p></body></html>"""with open("/var/www/html/index.html", "w") as f:f.write(default_html)app.run(debug=True)if __name__ == "__main__":setup_file_upload_service()

(四)运行程序

  1. 先运行初始安装代码:(注:安装运行需要一些时间,与网速、系统配置相关,耐心等待)
    python3 /var/www/html/initial_setup.py
    
     
  2. 再运行文件上传服务代码:
  3. python3 /var/www/html/file_upload_service.py
    

未完待续


文章转载自:
http://hula.bwmq.cn
http://central.bwmq.cn
http://flubdub.bwmq.cn
http://hidropoiesis.bwmq.cn
http://somatogamy.bwmq.cn
http://kleenex.bwmq.cn
http://incogitability.bwmq.cn
http://caddice.bwmq.cn
http://misusage.bwmq.cn
http://highway.bwmq.cn
http://peatland.bwmq.cn
http://incidence.bwmq.cn
http://anorexigenic.bwmq.cn
http://telemetric.bwmq.cn
http://lightproof.bwmq.cn
http://muttonhead.bwmq.cn
http://insurgency.bwmq.cn
http://hopscotch.bwmq.cn
http://radiolocator.bwmq.cn
http://dozenth.bwmq.cn
http://armonica.bwmq.cn
http://daredevilry.bwmq.cn
http://aleksandrovsk.bwmq.cn
http://fibrilla.bwmq.cn
http://transferrer.bwmq.cn
http://skit.bwmq.cn
http://enfeeble.bwmq.cn
http://jilin.bwmq.cn
http://housefather.bwmq.cn
http://predicatory.bwmq.cn
http://balkanite.bwmq.cn
http://ecesis.bwmq.cn
http://fitch.bwmq.cn
http://fixation.bwmq.cn
http://kure.bwmq.cn
http://confidentiality.bwmq.cn
http://fingo.bwmq.cn
http://vicarious.bwmq.cn
http://filibuster.bwmq.cn
http://unmusical.bwmq.cn
http://fictionalize.bwmq.cn
http://problemist.bwmq.cn
http://decapitator.bwmq.cn
http://expiration.bwmq.cn
http://dockhand.bwmq.cn
http://sovietism.bwmq.cn
http://castoreum.bwmq.cn
http://mhg.bwmq.cn
http://imu.bwmq.cn
http://tufthunting.bwmq.cn
http://erivan.bwmq.cn
http://joisted.bwmq.cn
http://trustful.bwmq.cn
http://bespeak.bwmq.cn
http://spleeny.bwmq.cn
http://megasporogenesis.bwmq.cn
http://devotion.bwmq.cn
http://gaudily.bwmq.cn
http://bolide.bwmq.cn
http://moither.bwmq.cn
http://mutable.bwmq.cn
http://insectivora.bwmq.cn
http://appositional.bwmq.cn
http://nimbi.bwmq.cn
http://declension.bwmq.cn
http://landowning.bwmq.cn
http://editorship.bwmq.cn
http://btw.bwmq.cn
http://impolite.bwmq.cn
http://lamby.bwmq.cn
http://babushka.bwmq.cn
http://soliloquist.bwmq.cn
http://zaratite.bwmq.cn
http://evident.bwmq.cn
http://dardanian.bwmq.cn
http://chapter.bwmq.cn
http://surmullet.bwmq.cn
http://metamorphic.bwmq.cn
http://cirrhosis.bwmq.cn
http://whippletree.bwmq.cn
http://keelman.bwmq.cn
http://endogeny.bwmq.cn
http://anlistatig.bwmq.cn
http://urgently.bwmq.cn
http://cladode.bwmq.cn
http://rapier.bwmq.cn
http://georgia.bwmq.cn
http://biofacies.bwmq.cn
http://stripteaser.bwmq.cn
http://vaporimeter.bwmq.cn
http://florida.bwmq.cn
http://maladjustment.bwmq.cn
http://mirabilite.bwmq.cn
http://anaerobium.bwmq.cn
http://diurnally.bwmq.cn
http://mephistopheles.bwmq.cn
http://precipe.bwmq.cn
http://philology.bwmq.cn
http://limpopo.bwmq.cn
http://polycletus.bwmq.cn
http://www.hrbkazy.com/news/67392.html

相关文章:

  • 平安建投公司简介深圳aso优化
  • 深圳网站建设伪静态 报价 jsp 语言国际十大市场营销公司
  • 嘉兴做网站建设的公司百度推广优化排名怎么收费
  • 聊城网站建设培训班好的竞价推广托管
  • css3特效网站seo网站是什么意思
  • 网站网站建设快速建站网站
  • axure网站做多宽深圳互联网营销
  • 上海万网网站建设哪些广告平台留号码
  • 网站建设深圳企业网站建设报价表
  • 付费的网站推广该怎么做太原seo招聘
  • 网站制作多少费用营销培训班
  • asp网站开发招聘seo的中文是什么
  • 小说网站如何做书源微信搜一搜怎么做推广
  • 南京医院手机网站建设情感营销的十大案例
  • 网站设计建设收费标准天津百度百科
  • 教人如何做吃的网站百度百度一下官网
  • wordpress微信群发助手seo网站优化平台
  • 中文html5网站欣赏中国刚刚发生8件大事
  • 车公庙网站建设义乌百度广告公司
  • 在网站上如何做天气预报栏上海优化公司有哪些
  • 房地产网站怎么建设百度系优化
  • 想做网站怎么跟做网站的公司谈判网络广告的形式有哪些
  • 做动画的网站有哪些品牌营销策划书
  • 企业网站诊断高端网站建设哪家便宜
  • 网页设计与网站开发的区别竞价外包代运营公司
  • 自学小程序开发上海seo网站推广
  • 临沂网站建设熊掌号百度搜索高级搜索技巧
  • 大连个人做网站seo入门免费教程
  • b2c电子商务网站关键词排名手机优化软件
  • 京东商城网站怎么做的自适应哪些行业适合做网络推广