Найти - Пользователи
Полная версия: Nginx+uwsgi+django: почему не подключается сокет?
Начало » Django » Nginx+uwsgi+django: почему не подключается сокет?
1
alexvoin7
Не удается деплойнуть сайт на джанго.
Владелец сокета рут. Папка с сайтом /jion_capital
Сокет лежит в ней
Nginx включен, линк конфигурации в sites-enabled есть
Запуск через
sudo uwsgi —socket jion.sock —module jion.wsgi —chmod-socket=664
Но не работает, err_connection_refused
Логи и conf ниже
Как исправить проблему?

Логи
2018/02/26 22:24:04 [error] 15025#15025: *5 open() "/usr/share/nginx/html/robots.txt" failed (2: No such file or directory), client: 52.5.98.73, server: localhost, request: "GET /robots.txt HTTP/1.1", host: "www.jion.capital"
2018/02/26 22:35:29 [error] 15025#15025: *9 open() "/usr/share/nginx/html/apple-touch-icon-precomposed.png" failed (2: No such file or directory), client: 188.134.71.223, server: localhost, request: "GET /apple-touch-icon-precomposed.png HTTP/1.1", host: "www.jion.capital"
2018/02/26 22:35:29 [error] 15025#15025: *10 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 188.134.71.223, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.jion.capital"
2018/02/26 22:35:30 [error] 15025#15025: *9 open() "/usr/share/nginx/html/apple-touch-icon.png" failed (2: No such file or directory), client: 188.134.71.223, server: localhost, request: "GET /apple-touch-icon.png HTTP/1.1", host: "www.jion.capital"
2018/02/26 22:35:30 [error] 15025#15025: *9 open() "/usr/share/nginx/html/apple-touch-icon-precomposed.png" failed (2: No such file or directory), client: 188.134.71.223, server: localhost, request: "GET /apple-touch-icon-precomposed.png HTTP/1.1", host: "www.jion.capital"
2018/02/26 22:35:30 [error] 15025#15025: *9 open() "/usr/share/nginx/html/apple-touch-icon.png" failed (2: No such file or directory), client: 188.134.71.223, server: localhost, request: "GET /apple-touch-icon.png HTTP/1.1", host: "www.jion.capital"
2018/02/26 22:46:12 [error] 15886#15886: *3 open() "/usr/share/nginx/html/wp-login.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /wp-login.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *4 open() "/usr/share/nginx/html/wordpress/wp-login.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /wordpress/wp-login.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *5 open() "/usr/share/nginx/html/wp/wp-login.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /wp/wp-login.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *6 open() "/usr/share/nginx/html/blog/wp-login.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /blog/wp-login.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *7 open() "/usr/share/nginx/html/administrator/index.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /administrator/index.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *8 open() "/usr/share/nginx/html/joomla/administrator/index.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /joomla/administrator/index.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *9 open() "/usr/share/nginx/html/cms/administrator/index.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /cms/administrator/index.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *10 open() "/usr/share/nginx/html/Joomla/administrator/index.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /Joomla/administrator/index.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *11 open() "/usr/share/nginx/html/status" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /status?full=true HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:15 [error] 15886#15886: *13 open() "/usr/share/nginx/html/script" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /script HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:16 [error] 15886#15886: *14 open() "/usr/share/nginx/html/jenkins/script" failed (2: No such file or directory),
client: 46.4.103.156, server: localhost, request: "GET /jenkins/script HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:16 [error] 15886#15886: *15 open() "/usr/share/nginx/html/login" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /login HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:16 [error] 15886#15886: *16 open() "/usr/share/nginx/html/jmx-console" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /jmx-console HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:16 [error] 15886#15886: *17 open() "/usr/share/nginx/html/manager/html" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /manager/html HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:16 [error] 15886#15886: *18 open() "/usr/share/nginx/html/msd" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /msd HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:16 [error] 15886#15886: *19 open() "/usr/share/nginx/html/mySqlDumper" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /mySqlDumper HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:16 [error] 15886#15886: *20 open() "/usr/share/nginx/html/msd1.24stable" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /msd1.24stable HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:17 [error] 15886#15886: *21 open() "/usr/share/nginx/html/msd1.24.4" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /msd1.24.4 HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:17 [error] 15886#15886: *22 open() "/usr/share/nginx/html/mysqldumper" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /mysqldumper HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:17 [error] 15886#15886: *23 open() "/usr/share/nginx/html/MySQLDumper" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /MySQLDumper HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:18 [error] 15886#15886: *24 open() "/usr/share/nginx/html/mysql" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /mysql HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:18 [error] 15886#15886: *25 open() "/usr/share/nginx/html/sql" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /sql HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:18 [error] 15886#15886: *26 open() "/usr/share/nginx/html/dumper" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /dumper HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:18 [error] 15886#15886: *27 open() "/usr/share/nginx/html/MySQL" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /MySQL HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:18 [error] 15886#15886: *28 open() "/usr/share/nginx/html/phpmyadmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /phpmyadmin HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:21 [error] 15886#15886: *29 open() "/usr/share/nginx/html/phpMyAdmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /phpMyAdmin HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:21 [error] 15886#15886: *30 open() "/usr/share/nginx/html/mysql" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /mysql HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:24 [error] 15886#15886: *31 open() "/usr/share/nginx/html/sql" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /sql HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:24 [error] 15886#15886: *32 open() "/usr/share/nginx/html/myadmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /myadmin
HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:24 [error] 15886#15886: *33 open() "/usr/share/nginx/html/phpMyAdmin-4.2.1-all-languages" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /phpMyAdmin-4.2.1-all-languages HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:24 [error] 15886#15886: *34 open() "/usr/share/nginx/html/phpMyAdmin-4.2.1-english" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /phpMyAdmin-4.2.1-english HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:24 [error] 15886#15886: *35 open() "/usr/share/nginx/html/xampp/phpmyadmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /xampp/phpmyadmin HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:25 [error] 15886#15886: *36 open() "/usr/share/nginx/html/typo3/phpmyadmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /typo3/phpmyadmin HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:25 [error] 15886#15886: *37 open() "/usr/share/nginx/html/webadmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /webadmin HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:25 [error] 15886#15886: *38 open() "/usr/share/nginx/html/Phpmyadmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /Phpmyadmin HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:26 [error] 15886#15886: *39 open() "/usr/share/nginx/html/PhPmyadmin" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /PhPmyadmin HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:27 [error] 15886#15886: *41 open() "/usr/share/nginx/html/sqlite/main.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /sqlite/main.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:27 [error] 15886#15886: *42 open() "/usr/share/nginx/html/SQLite/SQLiteManager-1.2.4/main.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /SQLite/SQLiteManager-1.2.4/main.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:27 [error] 15886#15886: *43 open() "/usr/share/nginx/html/SQLiteManager-1.2.4/main.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /SQLiteManager-1.2.4/main.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:27 [error] 15886#15886: *44 open() "/usr/share/nginx/html/sqlitemanager/main.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /sqlitemanager/main.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:27 [error] 15886#15886: *45 open() "/usr/share/nginx/html/SQlite/main.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /SQlite/main.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:27 [error] 15886#15886: *46 open() "/usr/share/nginx/html/SQLiteManager/main.php" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /SQLiteManager/main.php HTTP/1.1", host: "37.48.109.22:80"
2018/02/26 22:46:28 [error] 15886#15886: *47 open() "/usr/share/nginx/html/webdav" failed (2: No such file or directory), client: 46.4.103.156, server: localhost, request: "GET /webdav HTTP/1.1", host: "37.48.109.22:80"

Файл конфигурации
jion_nginx.conf 

# jion_nginx.conf

upstream django {
server unix:/jion_capital/jion.sock; # взаимодействие с uwsgi через Unix-сокет (мы воспользуемся этим вариантом позже)
#server 127.0.0.1:8000; # взаимодействие с uwsgi через веб-порт
}

# конфигурация веб-сервера
server {
# порт, который будет слушать веб-сервер в ожидании запросов от пользователй
listen 8000;
# доменное имя
server_name .jion.capital; # замените на собственный домен или IP адрес
charset utf-8;

# максимальный размер загружаемых на сервер данных
client_max_body_size 75M;

# обслуживание медиа файлов и статики
location /media/ {
alias /jion_capital/media/; # расположение медиафайлов (при необходимости измените)
}

location /static/ {
alias /jion_capital/static/; # расположение статики (при необходимости измените)
autoindex off;
}

# Остальные запросы перенаправляются в Django приложение
location / {
uwsgi_pass django;
include /jion_capital/uwsgi_params; # файл uwsgi_params, который мы только что взяли с github
}
}

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
VadimK
В кратце - сокет сделать не из под рута. И права на него 0666
IRIP
Все гораздо проще.
Но вы не дали конфиг uwsgi -в нем вся “соль”
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB