За последние 24 часа нас посетили 22637 программистов и 1017 роботов. Сейчас ищут 700 программистов ...

Yii2 nginx : is currently unable to handle this request. HTTP ERROR 500

Тема в разделе "Настройка веб-сервера", создана пользователем Padaboo, 4 апр 2019.

  1. Padaboo

    Padaboo Старожил
    Команда форума Модератор

    С нами с:
    26 окт 2009
    Сообщения:
    5.242
    Симпатии:
    1
    Yii2 Install path /srv/http/basic/web

    Nginx config:


    Код (Text):
    1. server {
    2.     charset utf-8;
    3.     client_max_body_size 256M;
    4.  
    5.     listen 80; ## listen for ipv4
    6.     #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
    7.  
    8.     server_name test.yii;
    9.     root        /srv/http/basic/web;
    10.     index       index.php;
    11.  
    12.     #access_log  /path/to/basic/log/access.log;
    13.     #error_log   /path/to/basic/log/error.log;
    14.  
    15.     location / {
    16.         # Redirect everything that isn't a real file to index.php
    17.         try_files $uri $uri/ /index.php$is_args$args;
    18.     }
    19.  
    20.     # uncomment to avoid processing of calls to non-existing static files by Yii
    21.     #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    22.     #    try_files $uri =404;
    23.     #}
    24.     #error_page 404 /404.html;
    25.  
    26.     # deny accessing php files for the /assets directory
    27.     location ~ ^/assets/.*\.php$ {
    28.         deny all;
    29.     }
    30.  
    31.     location ~ \.php$ {
    32.         include fastcgi_params;
    33.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    34.         #fastcgi_pass 127.0.0.1:9000;
    35.         fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    36.         try_files $uri =404;
    37.     }
    38.  
    39.     location ~* /\. {
    40.         deny all;
    41.     }
    42. }

    index.php

    Код (Text):
    1.  
    2. <?php
    3.  
    4. //phpinfo();
    5. // comment out the following two lines when deployed to production
    6. defined('YII_DEBUG') or define('YII_DEBUG', true);
    7. defined('YII_ENV') or define('YII_ENV', 'dev');
    8.  
    9. require __DIR__ . '/../vendor/autoload.php';
    10. require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
    11.  
    12. $config = require __DIR__ . '/../config/web.php';
    13.  
    14. (new yii\web\Application($config))->run();
    Error

    This page isn’t working
    test.yii is currently unable to handle this request.

    HTTP ERROR 500


    phpinfo работает

    Kак исправить ошибку?
    --- Добавлено ---
    2019/04/05 00:33:35 [error] 18139#18139: *1 FastCGI sent in stderr: "PHP message: PHP Warning: require(/srv/http/basic/web/../vendor/autoload.php): failed to open stream: No such file or directory in /srv/http/basic/web/index.php on line 8
    PHP message: PHP Fatal error: require(): Failed opening required '/srv/http/basic/web/../vendor/autoload.php' (include_path='.:/usr/share/php') in /srv/http/basic/web/index.php on line 8" while reading response header from upstream, client: 127.0.0.1, server: test.yii, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "test.yii"
     
  2. mkramer

    mkramer Суперстар
    Команда форума Модератор

    С нами с:
    20 июн 2012
    Сообщения:
    8.553
    Симпатии:
    1.754
    Так всё же понятно написано - нет файла. Этот файл генерируется автоматически программой composer по командам composer update, composer install. В репозиторий папку vendor обычно не кладут, поэтому при деплое проектов на современных фреймворках эту команду надо выполнить вручную
    --- Добавлено ---
    P.S. Не заметил, что ты тоже из команды форума, да и постарше меня.. Странный тогда вопрос...
     
  3. Padaboo

    Padaboo Старожил
    Команда форума Модератор

    С нами с:
    26 окт 2009
    Сообщения:
    5.242
    Симпатии:
    1
    В общем скачал нормальный архив с готовым проетом, там все файлы есть.