2017-10-19 3 views

답변

0

당신의 nginx 구성에 이런 식으로 뭔가를 추가하십시오. 이것은 api.website.com의 모든 요청을 gunicorn 소켓 -> django 앱에 전달합니다.

server { 
    listen *:80; 
    server_name api.website.com; 

    location ~ ^/api(.*)$ { 
     try_files $uri $1 /$1; 
    } 

    location/{ 
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
     proxy_set_header X-Forwarded-Proto $scheme; 

     proxy_set_header Host $http_host; 
     proxy_redirect off; 

     proxy_pass http://gunicorn_socket/; 
    } 
}