0

Поссле добавления блока location /admin/system/tests/ajax {...} роут перестал быть доступным, вылетает ошибка 404

Не силен в nginx, помогите разобраться в чем дело.

Если важно для чего я это пытлся сделать, то: Требовалось увеличить timeout выполения скрипта php для указанного маршрута. request_terminate_timeout и max_execution_time настроены

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    client_max_body_size 48M;

    root /var/www/html/название/public;

    # Add index.php to the list if you are using PHP
    index index.php index.html;

    server_name название;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying
            try_files $uri $uri/ /index.php?$query_string;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;

            # With php-fpm (or other unix sockets):
            fastcgi_pass unix:/run/php/php8.0-fpm.sock;
            # With php-cgi (or other tcp sockets):
            #fastcgi_pass 127.0.0.1:9000;
            fastcgi_read_timeout 300;
    }

    location /admin/system/tests/ajax {
        fastcgi_read_timeout 500;
        fastcgi_send_timeout 500;
    }

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

}

1 ответ 1

0

Полагаю ранее этот url обрабатывался у вас в location / и далее происходил rewrite на location ~ \.php$. Теперь же так не происходит т.к. вы создали новый location.

Полагаю что там у вас есть какой-то php скрипт и нужно передать ему запрос.

Тогда добавьте в этот location тоже, что у вас в location ~ \.php$.

Возможно понадобится прописать еще директивы: fastcgi_param. Минимально необходимые параметры:

fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name;
fastcgi_param QUERY_STRING    $query_string;

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.