阿里云项目部署

(
    如果xshell连接不上阿里云:
    解决方法:
        1, 在淘宝IP地址库查看当前IP: http://ip.taobao.com/ 
        2, 点击进入:安全(云盾) ->  安骑士(服务器安全)-> 设置 -> 安全配置 
        3, 在‘登录IP拦截加白’中点击添加, 将当前公网添加后点击确定
        参考网址: https://blog.csdn.net/zhangxing52077/article/details/78048254
)
 

1,安装nginx

1.1,访问:http://nginx.org/en/linux_packages.html
1.2,点击'this key' 查看官网提供的公钥, 并在Ubuntu下载这个公钥:
      wget http://nginx.org/keys/nginx_signing.key
1.3,添加key: apt-key add nginx_signing.key
1.4, 进入/etc/apt/sources.list文件:vim /etc/apt/sources.list
     并在最后添加软件包源: 
        deb http://nginx.org/packages/ubuntu/ xenial nginx
        deb-src http://nginx.org/packages/ubuntu/ xenial nginx
1.5,更新:apt update
1.6,安装nginx:apt install nginx
1.7,启动nginx: nginx
1.8, 在浏览器访问nginx服务器,查看是否安装好nginx
 

2, nginx配置部署‘打飞机’项目

2.1 可以查看nginx配置文件: vim /etc/nginx/nginx.conf
2.2 将项目文件压缩成zip,拖进xshell中(需要先使用命令安装lrzsz:apt install lrzsz)
2.3 使用unzip解压 

2.3 进入:cd /var/ , 创建自己的根目录: mkdir www, 
    再到www下创建项目目录: mkdir game,进入目录/var/www/game中
2.4 使用命令安装lrzsz:apt install lrzsz, 
    安装unzip: apt install unzip
2.5 把项目(dafeiji.zip)拖进xshell中并解压: unzip dafeiji.zip
2.6 配置自己的nginx.conf:
    将http -> server -> server_name设置为:公网ip地址
    将http -> server -> root 设置为:/var/www/game

    注释和添加location代码

    #location / {
    #   include uwsgi_params;
    #   uwsgi_pass localhost:8010;
    #}
    #location /static {
    #   alias /var/www/learn/AXF/static/;
    #}

    location /dafeiji {
        alias /var/www/game/dafeiji/;

    }

2.7 进入:cd /root, 将配置好的nginx.conf拖入xshell
2.8 停止nginx:nginx -s stop, 并将拖入的nginx.conf设置为nginx服务器的配置文件
        测试:nginx -t -c nginx.conf
        配置并运行:nginx -c /root/nginx.conf
2.9 在浏览器输入: http://60.205.181.47/dafeiji/02_dafeiji.html 访问即可
 

Django (十一) 项目部署 2的更多相关文章

  1. django 本地项目部署uwsgi 以及云服务器部署 uwsgi+Nginx+Docker+MySQL主从

    一 .django 本地项目部署uwsgi 1 本地部署项目 uwsgi安装测试 通过uwsgi 进行简单部署 安装uwsgi命令:pip install uwsgi -i http://pypi.d ...

  2. Django Web项目部署参考

    环境准备:1.Python 2.7.*]2.pip3.sudo pip install django4.sudo aptitude show python-setuptools5.sudo aptit ...

  3. Django (十三) 项目部署 3

    阿里云项目部署 部署Django项目   1, 配置nginx 1.1 进入:cd /var/www, 将外面压缩好的AXF项目拖入xshell中,并解压 1.2 配置nginx.conf: 将htt ...

  4. django之项目部署知识点

    一:项目部署的框架 nginx和uWSGI在生产服务器上进行的部署 二:什么是nginx? nginx是一个web服务器. 什么是web服务器? web服务器则主要是让客户可以通过浏览器进行访问,处理 ...

  5. 【Django】Django web项目部署(Nginx+uwsgi)

    一.安装uwsgi 通过pip安装uwsgi. pip install uwsgi 测试uwsgi,创建test.py文件: def application(env, start_response): ...

  6. Django (十) 项目部署 1

    阿里云部署项目 1, 购买阿里云ECS云服务器(可免费试用1个月) 2, 阿里云实例更换为Ubuntu 3, 安全组配置 4, xshell远程连接 5, 创建虚拟环境: 5.1 linux基本命令 ...

  7. django 项目部署在 Apache 后, 设置二级域名(Apache虚拟主机 、 万网二级域名设置)

    上一篇文章简单说了怎么把django的项目部署到Apache上. 现在想弄个二级域名,也就是我原来有个域名 www.mysite.com,现在我想弄个 bbs.mysite.com ,该怎么做呢. 要 ...

  8. Linux学习笔记之Django项目部署(CentOS)----进阶篇

    一.引入 当我们开发好了一个Django项目之后是需要部署到服务器上的,这样才能正式使用这个项目.之前用了一个运行.sh文件的方法让项目得以在后台运行,其实随着学习的深入,这种方法其实是有点low的, ...

  9. Linux Django项目部署

    步骤 .数据库的处理 1.1 上传bbs.sql 1.2 在mysql中创建bbs库,并导入数据库SQL脚本 mysql> create database bbs charset utf8mb4 ...

随机推荐

  1. (2)struts2配置祥解

    struts工作流程 反射 : 1.构造对象使用构造器 //类似为Servlet public class AddAction { public AddAction(){ System.out.pri ...

  2. Hadoop- Hadoop环境搭建

    Windows下Hadoop的安装 准备工具:64位的JDK,Hadoop安装包(我使用的是2.6.1) JDK下载地址 官网: http://www.oracle.com/technetwork/j ...

  3. Linux_异常_03_Failed to restart iptables.service: Unit not found.

    启动防火墙时出现: Failed to restart iptables.service: Unit not found. 解决方案: 1.https://stackoverflow.com/ques ...

  4. python web server gateway interface (wsgi ) notes

    前言: 注:如果需要得到支持批Python3.x以及包含了勘误表,附录,和说明的更新版规范,请查看PEP 3333 摘要: 这篇文档详细说明了一套在web服务器与Python web应用程序(web框 ...

  5. POJ2657Comfort(扩展欧几里得基础)

    A game-board consists of N fields placed around a circle. Fields are successively numbered from1 to ...

  6. 【Lintcode】122.Largest Rectangle in Histogram

    题目: Given n non-negative integers representing the histogram's bar height where the width of each ba ...

  7. CRC16算法之二:CRC16-CCITT-XMODEM算法的java实现

    CRC16算法系列文章: CRC16算法之一:CRC16-CCITT-FALSE算法的java实现 CRC16算法之二:CRC16-CCITT-XMODEM算法的java实现 CRC16算法之三:CR ...

  8. 浏览器关闭或刷新事件--window.onbeforeunload

    window.onunload=function(){ //不可以阻止浏览器的刷新或者关闭 return false; } window.onbeforeunload=function(){ //可以 ...

  9. Ubuntu下Apache重启错误:Could not reliably determine解决

    错误信息:apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 ...

  10. AI-Info-Micron-Solutions-Menu:Solutions

    ylbtech-AI-Info-Micron-Solutions-Menu:Solutions 1.返回顶部 1. 按应用分类 汽车解决方案 美光科技不仅是你的存储提供商,更是你的长期合作伙伴.我们提 ...