国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

django – nginx kann die Konfiguration in mysite_nginx.conf nicht anwenden, startet immer mit der Standardkonfiguration
僅有的幸福
僅有的幸福 2017-05-16 17:25:22
0
7
636

[Erg?nzung] über uwsgi_params:
Das sagt die offizielle Website:

Konfigurieren Sie Nginx für Ihre Site

Sie ben?tigen die Datei uwsgi_params, die im Nginx-Verzeichnis der uWSGI-Distribution oder unter https://github.com/nginx/nginx/blob/master/conf/uwsgi_params verfügbar ist Kopieren Sie es in Ihr Projektverzeichnis. Wir werden Nginx gleich anweisen, darauf zu verweisen.

[Originaltext]

Bei der Bereitstellung von uwsgi+nginx+django gem?? diesem Dokument http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html kann die Kombination von uwsgi und django oder reinem Python korrekte Ergebnisse liefern, und das ist auch der Fall installiert
nginx之后也能在瀏覽器刷新看到Welcome to nginx!.

Dann habe ich die Nginx-Konfigurationsdatei im Django-Projektordner erstellt:

# mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    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      8000;
    # the domain name it will serve for
    server_name 192.168.33.10; # substitute your machine's IP address or FQDN
    charset     utf-8;

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

    # Django media
    location /media  {
        alias /home/vagrant/mysite/mysite/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /home/vagrant/mysite/mysite/static; # your Django project's static files - amend as required
    }

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

Aber egal, ob Sie versuchen, test.py direkt zur Ausgabe von ?Hallo Welt“ zu verwenden oder den Django-Server zu starten, Sie k?nnen immer noch nur

Welcome to nginx! sehen, und der einzige Pfad, dem die Server-IP folgt, ist dieser.

Bei direkter Verwendung von test.py sieht die Ausgabe wie folgt aus:

$ uwsgi --socket :8001 --wsgi-file test.py *** Starting uWSGI 2.0.9 (64bit) on [Mon Feb  2 15:54:01 2015] ***
compiled with version: 4.6.3 on 02 February 2015 09:51:05
os: Linux-3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012
nodename: precise64
machine: x86_64
clock source: unix
detected number of CPU cores: 2
current working directory: /home/vagrant/mysite/mysite
detected binary path: /home/vagrant/mysite/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 2782
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :8001 fd 3
Python version: 2.7.3 (default, Dec 18 2014, 19:25:50)  [GCC 4.6.3]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1579b10
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1579b10 pid: 1655 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 1655, cores: 1)
僅有的幸福
僅有的幸福

Antworte allen(7)
習(xí)慣沉默

問題解決了。其實(shí)是因?yàn)?code>/etc/nginx/sites-enabled/下面有兩個(gè)配置文件:default和我自己配置的mysite_nginx.conf,nginx默認(rèn)使用了default。刪掉default就對(duì)了。

小葫蘆

配置文件沒有起作用,檢查是否正確讀取了 nginx的配置文件,先用個(gè)最簡(jiǎn)單的demo測(cè)試是否配置文件按是否生效

小葫蘆

Nginx 配置的是8000端口,你需要訪問nginx 的8000端口,

你的nginx django配置的是

 upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

所以啟動(dòng)django應(yīng)該以8001端口為基準(zhǔn)。

uwsgi_params 是在nginx里面。配置路徑錯(cuò)誤。 uwsgi_params 在 /etc/nginx/uwsgi_params
.

phpcn_u1582

接口沖突了,首先每個(gè)服務(wù)只監(jiān)聽1個(gè)接口,按照配置文件的理解應(yīng)該是,nginx:8000 django:8001
在這種情況下執(zhí)行python manage.py runserver localhost:8000 沒有報(bào)錯(cuò),說明nginx配置文件沒有起作用??赡苁褂玫倪€是默認(rèn)的80端口啟動(dòng)的,請(qǐng)檢查接口列表,linux命令為:
netstat -natp | grep nginx
如過想使用自定義的配置文件啟動(dòng),請(qǐng)nginx -h查看具體命令 大概是-p 或者-c.
在正確配置啟動(dòng)nginx情況下,啟動(dòng)django也應(yīng)該是使用python manage.py runserver localhost:8001 保證與配置文件設(shè)計(jì)相符

小葫蘆

你訪問的時(shí)候帶上端口號(hào)了嗎? http://192.168.33.10:8000

巴扎黑

確認(rèn)下配置文件指向是否正確,例如

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
Ty80

首先,記得帶端口號(hào)。

其次,報(bào)錯(cuò)說明你配置錯(cuò)了??村e(cuò)誤日志吧。

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage