0

我真的很难让它正常工作

在我的站点启用文件夹中,我设置了以下两个 .conf 文件

站点 A(这个站点我首先设置并正常工作):

# the upstream component nginx needs to connect to
upstream django {
    server 127.0.0.1:8001; # for a web port socket (we'll use this first)
    }

# configuration of the server
server {

    # the port your site will be served on
    listen  80;
    # the domain name it will serve for
    server_name databank.eaventures.co www.databank.eaventures.co ; # substitute your mac$
    charset     utf-8;
    access_log /srv/www/*****/logs/access.log;
    error_log /srv/www/*****/logs/error.log;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    location /media  {
        alias /srv/www/******/projectdatabank/media;  # your Django project's m$
    }

    location /static {
        alias /srv/www/******/projectdatabank/static; # your Django project's s$
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
        }
    }

站点 B(我正在尝试添加但未开始工作的新站点):

# the upstream component nginx needs to connect to
upstream django2 {
    server 127.0.0.1:8002; # for a web port socket (we'll use this first)
    }

# configuration of the server
server {
    # the port your site will be served on
    listen  80;
    # the domain name it will serve for
    server_name 50.116.47.120 ***.eaventures.co ; # substitute your machine's IP add$
    charset     utf-8;
    access_log /srv/www/***.capital.com/logs/access.log;
    error_log /srv/www/***capital.com/logs/error.log;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    location /media  {
        alias /srv/www/***capital.com/***/media;  # your Django project's media$
    }

    location /static {
        alias /srv/www/***capital.com/***/static; # your Django project's stati$
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
        }
    }

为了启动 uwsgi,我运行了以下命令(实际上我运行了一个 Emperor 命令,但是我想在这里一次解决一个问题),当我运行这个站点时,A 工作得很好

uwsgi --socket :8001 --chdir /srv/www/.com/projectdatabank/ --wsgi-file /srv/www/.com/projectdatabank/databank/wsgi.py

现在我运行它来尝试启动站点 B

uwsgi --socket :8002 --chdir /srv/www/***capital.com/***/ --wsgi-file /srv/www/***capital.com/***/***/wsgi.py

当我转到 IP 地址(在站点 B 上设置)时,它会运行站点 django 应用程序,但不会拉入 css 文件

有什么想法吗??

4

1 回答 1

2

我得到了这个工作,问题是 uwsgi_pass

我没有传递我认为连接到上游的 django 变量,而是分别为每个文件将其更改为以下

uwsgi_pass  127.0.0.1:8001;
uwsgi_pass  127.0.0.1:8002;
于 2013-10-26T19:13:13.603 回答