@Aquinary
Хинафаг.

Почему nginx не цепляет конфиг из /etc/nginx/sites-enabled/*.conf?

Доброго времени суток.
Имеется такой гайд по поднятию свого сервера (nginx + uwsgi + socket + django): https://habrahabr.ru/post/226419/
Всё идёт нормально, до тех пор, пока дело не касается настройки nginx.
/etc/nginx/nginx.conf

#user html;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}


/home/aquinary/source/uwsgi_turotial/mysite/mysite_nginx.conf

upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; 
    server 127.0.0.1:8001; 
}

server {
 
    listen      8000;
    server_name     localhost; 
    charset     utf-8;

    client_max_body_size 75M;  

    location /media  {
        alias /home/aquinary/source/uwsgi_tutorial/mysite/media; 
    }

    location /static {
        alias /home/aquinary/source/uwsgi_tutorial/mysite/static; 

    }

    location / {
        uwsgi_pass  django;
        include     /home/aquinary/source/uwsgi_tutorial/mysite/uwsgi_params; 
    }
}


Структура каталогов проекта

├── db.sqlite3
├── manage.py
├── media
│   └── media.png
├── mysite
│   ├── __init__.py
│   ├── media
│   │   └── media.png
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   ├── settings.cpython-36.pyc
│   │   ├── urls.cpython-36.pyc
│   │   └── wsgi.cpython-36.pyc
│   ├── settings.py
│   ├── static
│   │   └── admin
│   │       ├── css
│   │       │   ├── base.css
│   │       │   ├── changelists.css
│   │       │   ├── dashboard.css
│   │       │   ├── fonts.css
│   │       │   ├── forms.css
│   │       │   ├── login.css
│   │       │   ├── rtl.css
│   │       │   └── widgets.css
│   │       ├── fonts
│   │       │   ├── LICENSE.txt
│   │       │   ├── README.txt
│   │       │   ├── Roboto-Bold-webfont.woff
│   │       │   ├── Roboto-Light-webfont.woff
│   │       │   └── Roboto-Regular-webfont.woff
│   │       ├── img
│   │       │   ├── calendar-icons.svg
│   │       │   ├── gis
│   │       │   │   ├── move_vertex_off.svg
│   │       │   │   └── move_vertex_on.svg
│   │       │   ├── icon-addlink.svg
│   │       │   ├── icon-alert.svg
│   │       │   ├── icon-calendar.svg
│   │       │   ├── icon-changelink.svg
│   │       │   ├── icon-clock.svg
│   │       │   ├── icon-deletelink.svg
│   │       │   ├── icon-no.svg
│   │       │   ├── icon-unknown-alt.svg
│   │       │   ├── icon-unknown.svg
│   │       │   ├── icon-yes.svg
│   │       │   ├── inline-delete.svg
│   │       │   ├── LICENSE
│   │       │   ├── README.txt
│   │       │   ├── search.svg
│   │       │   ├── selector-icons.svg
│   │       │   ├── sorting-icons.svg
│   │       │   ├── tooltag-add.svg
│   │       │   └── tooltag-arrowright.svg
│   │       └── js
│   │           ├── actions.js
│   │           ├── actions.min.js
│   │           ├── admin
│   │           │   ├── DateTimeShortcuts.js
│   │           │   └── RelatedObjectLookups.js
│   │           ├── calendar.js
│   │           ├── cancel.js
│   │           ├── change_form.js
│   │           ├── collapse.js
│   │           ├── collapse.min.js
│   │           ├── core.js
│   │           ├── inlines.js
│   │           ├── inlines.min.js
│   │           ├── jquery.init.js
│   │           ├── popup_response.js
│   │           ├── prepopulate_init.js
│   │           ├── prepopulate.js
│   │           ├── prepopulate.min.js
│   │           ├── SelectBox.js
│   │           ├── SelectFilter2.js
│   │           ├── timeparse.js
│   │           ├── urlify.js
│   │           └── vendor
│   │               ├── jquery
│   │               │   ├── jquery.js
│   │               │   ├── jquery.min.js
│   │               │   └── LICENSE-JQUERY.txt
│   │               └── xregexp
│   │                   ├── LICENSE-XREGEXP.txt
│   │                   ├── xregexp.js
│   │                   └── xregexp.min.js
│   ├── urls.py
│   └── wsgi.py
├── mysite_nginx.conf
├── static
│   └── admin
│       ├── css
│       │   ├── base.css
│       │   ├── changelists.css
│       │   ├── dashboard.css
│       │   ├── fonts.css
│       │   ├── forms.css
│       │   ├── login.css
│       │   ├── rtl.css
│       │   └── widgets.css
│       ├── fonts
│       │   ├── LICENSE.txt
│       │   ├── README.txt
│       │   ├── Roboto-Bold-webfont.woff
│       │   ├── Roboto-Light-webfont.woff
│       │   └── Roboto-Regular-webfont.woff
│       ├── img
│       │   ├── calendar-icons.svg
│       │   ├── gis
│       │   │   ├── move_vertex_off.svg
│       │   │   └── move_vertex_on.svg
│       │   ├── icon-addlink.svg
│       │   ├── icon-alert.svg
│       │   ├── icon-calendar.svg
│       │   ├── icon-changelink.svg
│       │   ├── icon-clock.svg
│       │   ├── icon-deletelink.svg
│       │   ├── icon-no.svg
│       │   ├── icon-unknown-alt.svg
│       │   ├── icon-unknown.svg
│       │   ├── icon-yes.svg
│       │   ├── inline-delete.svg
│       │   ├── LICENSE
│       │   ├── README.txt
│       │   ├── search.svg
│       │   ├── selector-icons.svg
│       │   ├── sorting-icons.svg
│       │   ├── tooltag-add.svg
│       │   └── tooltag-arrowright.svg
│       └── js
│           ├── actions.js
│           ├── actions.min.js
│           ├── admin
│           │   ├── DateTimeShortcuts.js
│           │   └── RelatedObjectLookups.js
│           ├── calendar.js
│           ├── cancel.js
│           ├── change_form.js
│           ├── collapse.js
│           ├── collapse.min.js
│           ├── core.js
│           ├── inlines.js
│           ├── inlines.min.js
│           ├── jquery.init.js
│           ├── popup_response.js
│           ├── prepopulate_init.js
│           ├── prepopulate.js
│           ├── prepopulate.min.js
│           ├── SelectBox.js
│           ├── SelectFilter2.js
│           ├── timeparse.js
│           ├── urlify.js
│           └── vendor
│               ├── jquery
│               │   ├── jquery.js
│               │   ├── jquery.min.js
│               │   └── LICENSE-JQUERY.txt
│               └── xregexp
│                   ├── LICENSE-XREGEXP.txt
│                   ├── xregexp.js
│                   └── xregexp.min.js
├── test.py
└── uwsgi_params


systemctl status nginx.servive

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-07-31 16:00:24 MSK; 2s ago
  Process: 4915 ExecReload=/usr/bin/nginx -s reload (code=exited, status=0/SUCCESS)
  Process: 4959 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=0/SUCCESS)
 Main PID: 4961 (nginx)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/nginx.service
           ├─4961 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr;
           └─4962 nginx: worker process
июл 31 16:00:24 hentai systemd[1]: Stopped A high performance web server and a reverse proxy server.
июл 31 16:00:24 hentai systemd[1]: Starting A high performance web server and a reverse proxy server...
июл 31 16:00:24 hentai systemd[1]: nginx.service: PID file /run/nginx.pid not readable (yet?) after start: No such file or directory
июл 31 16:00:24 hentai systemd[1]: Started A high performance web server and a reverse proxy server.


Сим-линк в /etc/nginx/sites-enabled/ на mysite_nginx.conf лежит.
Сам по себе nginx работает и отлично детектится на localhost, 127.0.0.1 и 0.0.0.0
Так же сами по себе uWSGI и Django тоже функционируют. В чём может быть проблема?
  • Вопрос задан
  • 1222 просмотра
Решения вопроса 1
egor_nullptr
@egor_nullptr
В /etc/nginx/nginx.conf в секции http нет строки include /etc/nginx/sites-enabled/*.conf;
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы