A
A
Alex2014-10-21 02:10:50
Nginx
Alex, 2014-10-21 02:10:50

Nginx error - Primary script unknown ?

Hello.
I set up a third server, like the same settings, etc.
But here is the first error.

2014/10/21 03:03:50 [error] 6068#0: *3 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: test.lan, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "test.lan"

conf
server {
    listen 127.0.0.1:80;
    server_name test.lan www.test.lan;
    root var/www/test.lan/public_html;

    #index app.php index.php app_dev.php

    access_log /var/www/test.lan/access_log.log;
    error_log /var/www/test.lan/error_log.log;
 
    try_files $uri @rewriteapp;

    location @rewriteapp {
        rewrite ^(.*)$ /app.php/$1 last;
    }

    location ~ ^/(app|app_dev|config)\.php(/|$) {
  include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_param HTTPS off;
    }

    if ($host = 'www.test.lan') {
            rewrite ^/(.*)$ http://andr.lan/$1 permanent;
    }
}

I can't figure out what's wrong.
www-data:www-data 0755

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TomaZ Vazovsky, 2014-10-21
@Keksinautin

The error says that php-fmp cannot find the file you are asking to run.
In general, if you track the passage of the request through your config, then it turns out something like this:
1. a request came, even if /
2. try_files does not find such a file and sends it to @rewriteapp;
3. @rewriteapp sends us to the address /app.php//
4. now after the rewrite we get to the location and here we indicate that
SCRIPT_FILENAME = var/www/test.lan/public_html/app.php//
here is the address php- fmp does not find it.
p.s. are you sure you meant to specify a relative address in the root directive?
In php-fmp, it also comes as a relative one, and I won’t say right away whether its root is now the current directory or some other.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question