我試圖通過nginx的服務Django的靜態媒體,這是我的nginx.confnginx服務Django靜態媒體| 502網關
server {
listen 7777;
listen localhost:7777;
server_name example.com;
location/{
proxy_pass http://localhost:7777;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location /test-app-media/ {
root /sites/mysite/staticmedia/;
expires max;
}
}
,但給一個502 bad gateway
錯誤,路徑/sites/mysite/staticmedia/
是nginx的根目錄/是問題。 。
的Django在Apache 2.2運行+ mod_wsgi的
nginx的0.7.65
謝謝..
嘿,我沒有看到任何名爲proxy.conf和nginx的文件,那麼我在哪裏放置這些配置? – Switch 2010-04-10 14:17:32
有點晚了,但如果你是在Ubuntu上我把它放在conf.d文件夾中,'包括/etc/nginx/conf.d/* CONF;在nginx.conf'行尋找任何有。 conf extension,IE proxy.conf,因此你可能不需要在你的網站的nginx conf中包含'include /etc/nginx/proxy.conf'。 – TheLizardKing 2010-04-22 01:23:12
哦,對@renton來說,這正是我所需要的,並且這些少量修改完美無瑕。我重定向到我的非生產版本的Django的開發服務器,它只是完美的。謝謝! – TheLizardKing 2010-04-22 01:31:16