ich habe:Django: dient statischen Abschnitt eines Web-App
- ein Django Web-App
- eine separate statische HTML-Website (Blog)
Die statische Seite ist ein separates Verzeichnis Baum.
Ich möchte die statische Website als ein Unterabschnitt der Web-App bedient werden.
Zum Beispiel ist die App auf http://app.com/
und die statisch Website von http://app.com/blog
serviert
Hier ist mein /etc/nginx/sites-available/app
:
upstream app_server {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
...
location/{
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://app_server;
}
}
Sie können Setup eine separate Stelle für/Blog und Proxy es Ihre statische Website. –
@BipulJain also ist es nur Nginx-Konfiguration oder muss ich Django berühren? – astreltsov
@astrelsov enthalten Ihre aktuelle Nginx-Konfiguration für Detailantwort, überprüfen Sie meine Antwort –