Featured image of post nginx+uwsgi配置一个项目

nginx+uwsgi配置一个项目

通常用来配置flask或django

就在nginx第一个server里写

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 server {
		#监听端口,默认
        listen       80;
        #有域名写域名,ip地址也可以,_代表默认服务器名称,默认是localhost
        server_name  _;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
		
		# 项目文件配置
        location / {
            # 原来的注释
            #root   html;
            #index  index.html index.htm;
            # 配合uwsgi
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:5000;
        }
        # 项目静态文件,expires数字几就是保留几天
        location /static {
            alias /usr/local/GPS/static;
            expires 1d;
        }
Licensed under CC BY-NC-SA 4.0
最后更新于 Jul 30, 2025 00:00 UTC