linux部署的flask项目配置static
环境:
- Python2.7
- flask
- nginx
- linux的系统是Ubantu
Python:我的是linux已经有的。
flask:pip install flask
nginx:sudo apt-get install nginx
具体步骤请看前几篇博客。
以上过程结束后,进行如下操作:
sudo vim /etc/nginx/sites-available/default
进入编辑:
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
## # Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server; # SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf; root /var/www/html;
location /allstatic {
alias /zzy/zzy/atatic;
} # Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html; server_name _; location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
在配置文件里面增加:
root /var/www/html;
location /allstatic {
alias /zzy/zzy/atatic;
}
即可!
参考http://wiki.ubuntu.org.cn/Nginx
linux部署的flask项目配置static的更多相关文章
- 使用Nginx+Uwsgi部署Python Flask项目
第一次用Flask做Web(也是第一次用Python做Web),在部署的时候遇到了不少问题,现在将过程就下来,供在这方面也有疑惑的人参考.(PS:使用Apache+mod_wsgi部署模式的可以参考另 ...
- 【Centos】【Python】【Flask】阿里云上部署一个 flask 项目
1. 安装 python3 和 pip3 参考:http://www.cnblogs.com/mqxs/p/8692870.html 2.安装 lnmpa 集成开发环境 参考:http://www.c ...
- Linux 部署.Net Core 项目
前面也有说到,我学习Linux 主要因为要学习一下部署.NET CORE项目到Linux 系统,这里就记录一下部署的详细步骤吧. 主要需要安装以下几个工具 1..NET CORE SDK 2.Jexu ...
- linux部署.net Core项目
首篇笔记,多多关照.方便回忆和给新手指导,大神绕道 首先在Linux系统部署.net Core项目首先准备一个Linux系统的服务器,百度云,阿里云都行. 1.net core 部署在Linux系统上 ...
- [傻瓜式一步到位] 阿里云服务器Centos上部署一个Flask项目
网络上关于flask部署Centos的教程有挺多,不过也很杂乱. 在我第一次将flask上传到centos服务器中遇到了不少问题,也费了挺大的劲. 在参考了一些教程,并综合了几个教程之后才将flask ...
- 【Azure 应用服务】App Service For Linux 部署PHP Laravel 项目,如何修改首页路径为 wwwroot\public\index.php
问题描述 参考官方文档部署 PHP Laravel 项目到App Service for Linux环境中,但是访问应用时候遇见了500 Server Error 错误. 从部署的日志中,可以明确看出 ...
- centos 6.x 部署uwsgi+flask项目
一.项目背景 1. 公司需求要做一个在线统计页面; 2. 统计在线人数,进行人数数据展示; 3. 类似QQ官网在线人数 二.测试环境 [root@linux-node2 ~]# cat /etc/*r ...
- 一个jetty部署多个项目配置之方法一
https://my.oschina.net/wangyongqing/blog/115647 Jetty用户经常想配置他们的web应用到不同的虚拟主机. 通常情况下,一个单一的IP地址的机器有不同的 ...
- 【flask】flask项目配置 app.config
[理论] 在很多情况下,你需要设置程序的某些行为,这时你就需要使用配置变量.在Flask中,配置变量就是一些大写形式的Python变量, 你也可以称之为配置参数或配置键.使用统一的配置变量可以避免在程 ...
随机推荐
- 2012服务器在IIS部署的SLL(https)网址谷歌浏览器无法访问的问题解决
服务器环境:Windows Server 2012,IIS8. 当绑定了https,使用IE和Firefox浏览器能够正常访问,但是使用谷歌浏览器会出现net::ERR_CONNECTION_ABOR ...
- UART简介及与COM口的区别
原帖地址:https://blog.csdn.net/jirryzhang/article/details/70084743 https://www.cnblogs.com/smartjourneys ...
- 深度学习框架Tensor张量的操作使用
- 重点掌握基本张量使用及与numpy的区别 - 掌握张量维度操作(拼接.维度扩展.压缩.转置.重复……) numpy基本操作: numpy学习4:NumPy基本操作 NumPy 教程 1. Tens ...
- ShrePoint 迁移域控
背景: 客户的AD服务器换掉,重新安装AD,SharePoint服务器重新加入域后,将所有服务账号换成新域的账号. 虽然SP的应用程序采用的是表单认证,但是,用户(包括管理员)访问站点,添加数据的时候 ...
- Mac NVM 配置
1.NVM 简介 NVM(node version manager)是一个可以让你在同一台机器上安装和切换不同版本 node 的工具. GitHub 地址 2.NVM 环境配置 2.1 安装 NVM ...
- C#版Websocket实例
C#版Websocket实例 Demo地址:www.awbeci.xyz websocket有java.nodejs.python,Php等等版本,我使用的是C#版本,服务器端是Fleck,git ...
- MySql基本查询、连接查询、子查询、正则表达查询解说
林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 查询数据指从数据库中获取所须要的数据.查询数据是数据库操作中最经常使用,也是最重要的操作.用户 ...
- HTML中 javascript 相对根路径问题
在HTML文档中,有很多引用的JS或者CSS文件,一般都是用相对路径来引用的,例如: ./../.. ,但是,有没有类似ASP.NET中的路径: ~/Scripts/myScript.js 但是有的: ...
- 大数据:Hive - ORC 文件存储格式
一.ORC File文件结构 ORC的全称是(Optimized Row Columnar),ORC文件格式是一种Hadoop生态圈中的列式存储格式,它的产生早在2013年初,最初产生自Apache ...
- 红米3 TWRP-3.2.1-0(android_7.1.2_r29) 刷8.1不提示错误 刷MIUI不再卡屏 修复无系统重启问题 更新于20180316
TWRP简介: TWRP是一个安卓平台很受欢迎的第三方REC,界面好看,功能强大. TWRP更新日志: 20180316更新: 1.使用最新android-7.1.2_r29分支源码适配. 2.更新版 ...