dexvanoni
2 years ago
4742
22
Servers

Nginx does not work with laravel

Posted 2 years ago by dexvanoni

My sites-avaliable/default configuration

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/(.*)$ / break;
    rewrite ^/tapio2018/(.*)$ /index.php?__path__=/ last;
    try_files $uri $uri/ /index.php?$args;

}
location ~ \.php$ {

            set $newurl $request_uri;

            if ($newurl ~ ^/tapio2018(.*)$) {
                   set $newurl ;
                  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;
}
}

The first page appears without css and js. The other routes appear: No input file specified.

Please sign in or create an account to participate in this conversation.