2
我真的很緊張,因爲我想讓這個網站在我的Ubuntu服務器上運行。我只是一個嘗試自己託管東西的前衛。我覺得我差點把它弄倒。但訪問該域時仍然收到502錯誤的網關錯誤。與Django/nginx/uwsgi 502錯誤
這是我的項目樹:
-- var
-- www
-- stacaravanverhuurgroesbeek
|-- env/
|-- logs/
|-- access.log
|-- error.log
`-- uwsgi.log
|-- conf/
| |-- stacaravanverhuurgroesbeek.sock
| `-- uwsgi.ini
`-- public/
|-- manage.py
|-- media/
|-- project.db
|-- requirements.txt
|-- static/
`-- website/
|-- dev/
|-- gulp/
|-- gulpfile.js
|-- package.json
|-- settings.py
|-- static/
|-- templates/
|-- urls.py
`-- wsgi.py
我uwsgi ini文件: /var/www/stacaravanverhuurgroesbeek/conf/uwsgi.ini
:
[uwsgi]
# variables
projectname = stacaravanverhuurgroesbeek
projectdomain = stacaravanverhuurgroesbeek.nl
base = /var/www/stacaravanverhuurgroesbeek
# config
chdir = %(base)/public
home = %(base)/env
wsgi-file = %(base)/public/website/wsgi.py
master = True
processes = 5
socket = %(base)/conf/%(projectname).sock
vacuum = true
die-on-term = true
logto = %(base)/logs/uwsgi.log
我的nginx的配置: /etc/nginx/sites-available/stacaravanverhuurgroesbeek
:
server {
listen 80;
server_name stacaravanverhuurgroesbeek.nl www.stacaravanverhuurgroesbeek.nl;
root /var/www/stacaravanverhuurgroesbeek/;
access_log /var/www/stacaravanverhuurgroesbeek/logs/access.log;
error_log /var/www/stacaravanverhuurgroesbeek/logs/error.log;
location /static/ {
root /var/www/stacaravanverhuurgroesbeek/public/static/;
}
location /media/ {
root /var/www/stacaravanverhuurgroesbeek/public/media/;
}
location/{
include uwsgi_params;
uwsgi_pass unix:///var/www/stacaravanverhuurgroesbeek/conf/stacaravanverhuurgroesbeek.sock;
}
}
我也符號鏈接這個文件至sites-enabled
。
我的啓動腳本: /etc/init/uwsgi.conf
# Emperor uWSGI script
description "uWSGI Emperor"
start on runlevel [2345]
stop on runlevel [!2345]
setuid bastard
setgid bastard
exec uwsgi --master --emperor /etc/uwsgi/vassals
而且每次我改變了我的東西都重新啓動nginx的和uwsgi,沒有效果。
我真的很希望有人能看到我的設置中存在什麼問題。
你的wsgi配置鏈接到vassals?皇帝如何找到你的配置? – electrometro
@electrometro是的,我將它鏈接到了vassals目錄.. –
該unix套接字路徑名應該有三個斜槓嗎?通常人會這樣做。 –