lundi 5 juin 2017

Laravel site works in directory, but isn't opened when move to subdirectory in Ubuntu 16.04

I am using Ubuntu 16.04. Here is my virtual host configuration. I edited my root folder from

/var/www/http://ift.tt/2rWhofl

to

/var/www/http://ift.tt/18GT7ew

Then I configured my vitualhost for sub directory, as below. Site shows only white screen. Error log, nginx error log is empty.

server {
        listen 80;
        #listen [::]:80 default_server ipv6only=on;

    root /var/www/http://ift.tt/18GT7ew;
    index index.php index.html index.htm;

    server_name example.com www.example.com;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    error_log /var/www/logs/error.log;

   location = /50x.html {
            root /usr/share/nginx/html;
    }

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;

    }

    location ^~ /mysite {

            alias /var/www/http://ift.tt/2rWhofl;
            try_files $uri $uri/ @mysite;

            location ~* \.php {
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_split_path_info ^(.+\.php)(.*)$;
                include /etc/nginx/fastcgi_params;
            }
    }

    location @mysite {
            rewrite ^/mysite/(.*)$ /mysite/index.php?/$1 last;
    }

}

I can't figure out what is a problem.

1) File permissions, laravel configuration had been done correctly. 2) I assume that the problem is with php fpm. But it works, opening the website without subdirectory

I had done same thing before in Ubuntu 14.04. It seems, in Ubuntu 16.04 there is some difference. Also, I checked my public/index.php, added there die() function with message. But, again was white screen. Maybe, I miss something while configuring Nginx ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire