如何将默认Web位置从root用户目录更改为Nginx中的另一个用户目录?

时间:2019-06-28 10:07:10

标签: django nginx uwsgi

我是Nginx的新手,由于某些原因,我已经创建了Django应用并部署在根用户主目录中;我需要将其移至其他用户主目录中。我已经进行了所有更改,但是当我访问该网站时,它仍然指向同一根用户目录中的应用程序。

以前 /etc/uwsgi/sites/djangoproject.ini

[uwsgi]    
project = djangoproject    
username = root    
base = /%(username)    
chdir = %(base)/%(project)    
home = %(base)/Env/%(project)    
module = %(project).wsgi:application    
master = true
processes = 5    
uid = %(username)    
socket = /run/uwsgi/%(project).sock    
chown-socket = %(username):nginx    
chmod-socket = 660    
vacuum = true

当前: /etc/uwsgi/sites/djangoproject.ini

[uwsgi]
project = djangoproject
username = jenkins
base = /scratch/%(username)

chdir = /home/%(username)/%(project)
home = %(base)/Env/%(project)
module = %(project).wsgi:application

master = true
processes = 5

uid = %(username)
socket = /run/uwsgi/%(project).sock
chown-socket = %(username):nginx
chmod-socket = 660
vacuum = true

当前: /etc/nginx/nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;


    sendfile        on;
    server {
    listen 8001;
    listen svcpjanjana.nms.fnc.fujitsu.com:8001;
    server_name svcpjanjana.nms.fnc.fujitsu.com;

    location = favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/jenkins/djangoproject;
    }

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/djangoproject.sock;
    }
    }

以前: /etc/nginx/nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;


    sendfile        on;
    server {
    listen 8001;
    listen svcpjanjana.nms.fnc.fujitsu.com:8001;
    server_name svcpjanjana.nms.fnc.fujitsu.com;

    location = favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /root/djangoproject;
    }

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/djangoproject.sock;
    }
    }

您能帮我检查一下为什么它仍然指向根目录吗?

0 个答案:

没有答案