如何在云主机部署网站服务器?

 云主机的使用不仅仅是企业网站,个人也是可以利用它来搭建自己的网站。在云主机上如何实现基于nginx部署flask的网站服务器?下面万变云带来详细的操作步骤,以供大家参考。

  1、申请云主机

  2、把网站服务器程序拷贝到云主机

  3、远程登录云主机

  4、解压网站服务器程序

  yum install bzip2

  tar -xvf 03IotServer.tar.bz2

  5、安装Python3

  yum list |grep python

  yum install python36.x86_64

  6、创建Python虚拟环境

  cd 03IotServer

  mkdir env

  python36 -m venv ./env/

  7、安装网站服务器需要的包

  ./env/bin/pip install –upgrade pip

  ./env/bin/pip install -r requirements.txt

  8、安装mysql

  yum list |grep maridb

  yum install mariadb.x86_64 mariadb-server.x86_64

  systemctl restart mariadb

  mysql_secure_installation

  9、创建数据库

  mysql -uroot -pLzy123456

  MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS uplooking DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

  10、修改网站服务器配置

  vim config.py

  修改mysql用户名、密码、数据库

  11、数据库迁移

  ./env/bin/python run.py db init

  ./env/bin/python run.py db migrate

  ./env/bin/python run.py db upgrade

  12、调用网站服务器的init命令

  ./env/bin/python run.py init

  13、安装gunicorn

  ./env/bin/pip install gunicorn

  14、修改网站服务器运行文件run.py

  vim run.py

  去掉manager.run()

  15、启动gunicorn

  ./env/bin/gunicorn -w 4 -b 127.0.0.1:8080 –chdir ./ run:app

  16、安装nginx

  yum install nginx

  17、配置nginx

  vim /etc/nginx/nginx.conf

  18、重启nginx

  service nginx restart

以上就是本次教程的具体流程,大家可以自己动手来进行部署。

文章来源: http://www.rakbuluo.com/p100/

原文链接:,转发请注明来源!

发表评论

要发表评论,您必须先登录

  • 9 Responses to “如何在云主机部署网站服务器?”
    • EdwardPhymn

      generic pills <a href=" https://genericwdp.com/# ">best online international pharmacies india</a>
      buy cheap prescription drugs online

    • viagra plus aibkhw

      viagra at canadian pharmacy <a href="http://edpharmacystore.com/">going here</a> cialis canadian pharmacies
      <a href=http://edpharmacystore.com/>click this over here now</a>

    • CharlesHob

      tinder date , tinder date
      <a href=http://tinderdatingsiteus.com/?>tinder date </a>

    • the canadian pharmacy cwgnbs

      online pharmacy without a prescription <a href="http://edpharmacystore.com/">look at this web-site</a> online pharmacy without a prescription
      <a href=http://edpharmacystore.com/>browse this site</a>

    • generic drugs fkakgw

      sample viagra <a href=http://www.canada1drugstore.com/tadalafil/>5mg cialis</a> taking viagra
      <a href="http://www.canada1drugstore.com/tadalafil/">viagra 50 mg</a> do you need a prescription for viagra in canada

    • CharlesHob

      tinder sign up , tinder dating app
      <a href=http://tinderdatingsiteus.com/?>tinder dating app </a>

    • canadian pharmacy for viagra mrofmw

      herbal viagra reviews <a href="https://gitlab.pagedmedia.org/zimmermanbeasley8">online medications</a> viagra patent <a href=https://wikidot.win/wiki/Overview_On_How_To_Overcome_Diabetes_Easily>viagra samples free</a> ed meds
      best price cialis <a href="http://www.teknallsnc.com/index.php?option=com_k2&view=itemlist&task=user&id=1760860">viagra sale online</a> how long does viagra last <a href=https://genius.com/mcgarrydickens4>lowest price viagra</a> cvs pharmacy
      genuine viagra <a href="https://bookmarkspot.win/story.php?title=one-of-the-most-unique-tips-for-losing-more-weight-6#discuss">viagra tablets</a> online pharmacy viagra <a href=http://163.30.42.16/~health2017/userinfo.php?uid=3372784>viagra australia</a> www.canadadrugsonline.com
      best price for cialis

    • canadian pharmacy viagra online fasolh

      www.walmart.com <a href=http://www.canada1drugstore.com/tadalafil/>canada online pharmacy viagra</a> www.canadadrugsonline.com
      <a href="http://www.canada1drugstore.com/tadalafil/">cialis</a> canada viagra

    • tinder dating

      tinder app , what is tinder