Nginx Переписать на другой сайт, давая "Входной файл не найден" - PullRequest
0 голосов
/ 27 ноября 2018

Я читал другие посты, но не могу их получить.У меня есть приложение Laravel (listnaples.test) в одном каталоге и Wordpress (blog.listingnaples.test) в другом, чтобы хранить вещи отдельно.

http://listingnaples.test работает.

http://blog.listingnaples.test работает.

http://listingnaples.test/blog/ должен перенаправить, но выдает ошибку «Не указан входной файл».

Надеюсь, это не имеет значения для ответа, но этоэто усадьба в Ларавеле для местного развития.Вот блок сервера:

block="server {
    listen ${3:-80};
    listen ${4:-443} ssl http2;
    server_name .$1;
    root \"$2\";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files \$uri \$uri/ /index.php?\$query_string;
        $headersTXT
    }

    $configureZray

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/$1-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
        $paramsTXT

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }
    location /blog/ {
        access_log off;
        proxy_pass http://blog.listingnaples.test;
    }
    ssl_certificate     /etc/nginx/ssl/$1.crt;
    ssl_certificate_key /etc/nginx/ssl/$1.key;
}

РЕДАКТИРОВАТЬ: ЖУРНАЛ ОШИБКИ

В журнале ошибок есть следующие строки:

2018/11/26 21:09:28 [emerg] 600#600: location "/blog/" is outside location "\.php$" in /etc/nginx/sites-enabled/blog.listingnaples.test:50 2018/11/26 21:27:01 [emerg] 7798#7798: invalid URL prefix in /etc/nginx/sites-enabled/listingnaples.test:49 2018/11/26 21:51:48 [emerg] 23588#23588: invalid URL prefix in /etc/nginx/sites-enabled/listingnaples.test:49

РЕДАКТИРОВАТЬ 2: Код не там

2018/11/26 21:25:41 [error] 5392#5392: *11 FastCGI sent in stderr: "Unable to open primary script: /home/vagrant/code/ln/public/blog/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.10.1, server: listingnaples.test, request: "GET /blog/index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "listingnaples.test"

Блог не находится в / home / vagrant / code / ln /публичный / блог / index.php.Он находится в /home/vagrant/code/blog.listingnaples.com/index.php

Я думаю, он пытается перенаправить, но не в тот каталог.

Обычно подсказка поможетя, но теперь я больше в замешательстве.

...