2012-09-28 2 views
0

디버그 모드를 닫고 exsit이 아닌 페이지를 방문하면 기본 502 오류가 표시됩니다.nginx + uwsgi + django, 404.html 및 502.html을 구성하는 방법

내 프로젝트에 404.html, 403.html, 502.html을 넣었으나이 페이지를 볼 수 없지만 프로젝트는이 부분을 제외한 모든 부분에서 잘 작동합니다.이 문제에 대해서는 어떻게 설정해야합니까?

아래 내 구성 :

server{ 
listen 80; 
server_name 119.254.35.221; 
location /{ 
uwsgi_pass 127.0.0.1:8000; 
include uwsgi_params; 
uwsgi_param UWSGI_SCRIPT www.wsgi; 
uwsgi_param UWSGI_CHDIR /root/www; 
uwsgi_param UWSGI_PYHOME /root/www; 
uwsgi_param SCRIPT_NAME ""; 
} 
} 

프로젝트 트리 :

[[email protected] www]# pwd 
/root/www 
[[email protected] www]# ll 
total 1036 
drwxr-xr-x 2 root root 4096 Sep 28 11:05 books 
-rwxr-xr-x 1 root root  246 Sep 27 13:29 manage.py 
-rw------- 1 root root 6228 Sep 28 09:56 nohup.out 
-rwxr-xr-x 1 root root  41 Sep 27 23:54 restart.sh 
-rwxr-xr-x 1 root root  53 Sep 28 16:51 start.sh 
drwxr-xr-x 2 root root 4096 Sep 28 20:18 static 
-rw-rw-rw- 1 root root  217 Sep 28 14:05 uwsgi.ini 
-rw-r--r-- 1 root root  272 Sep 27 23:16 uwsgi.xml.backup 
drwxr-xr-x 3 root root 4096 Sep 28 20:27 www 
-rw-r----- 1 root root 1009290 Sep 28 20:25 www.log 
-rw-rw-rw- 1 root root  6 Sep 28 16:48 www.pid 
[[email protected] www]# ll www 
total 48 
-rw-r--r-- 1 root root 0 Sep 28 20:27 403.html 
-rw-r--r-- 1 root root 0 Sep 28 20:18 404.html 
-rw-r--r-- 1 root root 227 Sep 28 17:01 forms.py 
-rw-r--r-- 1 root root 0 Sep 27 13:29 __init__.py 
-rw-r--r-- 1 root root 112 Sep 28 08:46 __init__.pyc 
-rw-r--r-- 1 root root 5247 Sep 28 20:20 settings.py 
-rw-r--r-- 1 root root 2924 Sep 28 20:20 settings.pyc 
drwxr-xr-x 2 root root 4096 Sep 28 17:04 templates 
-rw-r--r-- 1 root root 630 Sep 28 16:47 urls.py 
-rw-r--r-- 1 root root 641 Sep 28 11:03 urls.pyc 
-rw-r--r-- 1 root root 625 Sep 28 17:22 views.py 
-rw-r--r-- 1 root root 871 Sep 28 11:03 views.pyc 
-rw-r--r-- 1 root root 1126 Sep 28 12:32 wsgi.py 
-rw-r--r-- 1 root root 1000 Sep 28 12:32 wsgi.pyc 
[[email protected] www]# 

uwsgi의 설정 :

[[email protected] www]# cat uwsgi.ini 
[uwsgi] 
uid = 500 
listen=200 
master = true 
profiler = true 
processes = 8 
logdate = true 
pidfile = /root/www/www.pid 
daemonize = /root/www/www.log 
enable-threads = true 
memory-report = true 
limit-as = 6048 

시작 명령 :

uwsgi --ini uwsgi.ini -s 127.0.0.1:8000 

감사합니다.

+0

는 당신이 실제로 원하는 것은 무엇을 보여주는 것입니다 이동 시도? –

답변

0

으로 404.html, (당신이있는 경우에 당신은 당신의 base_site.html가) 템플릿 디렉토리 내부 등 ... 파일

+0

덕분에 많이 작동합니다! ~ –

+0

당신은 대답을 받아 들일 수 있습니까? ;) – abidibo

+0

또 다른 질문은 :/root/www/static에 staic 파일을 보여주기 위해 nginx를 설정하는 방법입니다. 여기를 기다려 주셔서 감사합니다. –

관련 문제