CSS and JS of the Laravel project does not work on NGINX

Asked

Viewed 221 times

1

configuration /etc/Nginx/sites-avaliable/default

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

root /var/www/html/;
index index.php index.html index.htm index.nginx-debian.html;

server_name 10.152.16.97;

sendfile off;

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

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

}

location /tapio2018 {
    root /var/www/html/tapio2018/public;
    #rewrite ^/tapio2018/(.*)$ /$1 break;
    rewrite ^/tapio2018/(.*)$ /index.php?__path__=/$1 last;
    try_files $uri $uri/ /index.php?$args;

}
location ~ \.php$ {

            set $newurl $request_uri;

            if ($newurl ~ ^/tapio2018(.*)$) {
                   set $newurl $1;
                  root /var/www/html/tapio2018/public;
            }

            # Pass all PHP files to fastcgi php fpm unix socket
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            #fastcgi_pass unix:/var/run/php5-fpm.sock;      #debian php5
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; #debian php7
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param REQUEST_URI $newurl;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_intercept_errors off;
            fastcgi_buffer_size 16k;
            fastcgi_buffers 4 16k;
        }
location ~ /\.ht {
    deny all;
}
}

No error.log

[error] 11890#11890: *1 Fastcgi sent in stderr: "Unable to open Primary script: /var/www/html/index.php (No such file or directory)" while Reading Response header from upstream, client: 10.152.16.76, server: 10.152.16.97, request: "GET /js/jquery-1.12.4.js HTTP/1.1", upstream: "fastcgi://Unix:/var/run/php/php7.0-fpm.Sock:", host: "10.152.16.97", referrer: "http://10.152.16.97/tapio2018/"

In the browser the request URL is:

http://10.152.16.97/bst/css/bootstrap.min.css

but it was meant to be

http://10.152.16.97/tapio2018/public/bst/css/bootstrap.min.css right?

All css and js files do not work and any other path appears: **No input file specified. **! Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.