我正在使用ubuntu 14.04並運行nginx 1.4.6作爲反向代理服務器來與我在uwsgi上運行的django後端進行通信。我無法讓內部重定向工作,也就是說,請求根本沒有達到django。這裏是我的nginx配置/etc/nginx/site-enabled/default
文件。請讓我知道我的配置有什麼問題。無法讓nginx內部重定向工作
server {
listen 8080;
listen 8443 default_server ssl;
server_name localhost;
client_max_body_size 50M;
access_log /var/log/nginx/nf.access.log;
error_log /var/log/nginx/nf.error_log debug;
ssl_certificate /etc/ssl/nf/nf.crt;
ssl_certificate_key /etc/ssl/nf/nf.key;
location/{
proxy_pass http://localhost:8000;
}
location /static/ {
root /home/northfacing;
}
location /media/ {
internal;
root /home/northfacing;
}
}
添加我的uwsgi配置。
[uwsgi]
chdir=/home/northfacing/reia
module=reia.wsgi:application
master=True
pidfile=/home/northfacing/reia/reia-uwsgi.pid
vacuum=True
max-requests=5000
daemonize=/home/northfacing/reia/log/reia-uwsgi.log
http = 127.0.0.1:8000
添加我的uwsgi啓動腳本
#!/bin/bash
USER="northfacing"
PIDFILE="/home/northfacing/reia/reia-uwsgi.pid"
function start(){
su - ${USER} /bin/sh -c "source /home/northfacing/nfenv/bin/activate && exec uwsgi --pidfile=${PIDFILE} --master --ini /etc/init.d/reia-uwsgi.ini"
}
function stop(){
kill -9 `cat ${PIDFILE}`
}
$1
/家庭/ northfacing/nfenv是我的Python環境目錄。
從什麼URL到你想要重定向的URL? – GwynBleidD
另外,如果您使用uWSGI,請考慮使用本機uwsgi協議('uwsgi_pass')而不是'proxy_pass'。 – GwynBleidD
你做什麼,什麼不工作? –