简体   繁体   中英

nginx setup does not work

I created a new instance on digital ocean and installed laravel (via cloning a git repo I have worked on). I then configured the default config for nginx, but the site is not even remotely accessible.

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

    root /var/www/mfserver/public/;
    index index.php index.html index.htm;

    server_name IPADDRESS;

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

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

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

The answer in the brwoser is: "SERVERIP is currently unable to handle this request."

The error I get is this in the error.log

PHP message: PHP Fatal error: require(): Failed opening required '/var/www/mfserver/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/mfserver/bootstrap/autoload.php on line 17" while reading response header from upstream,$

The error might have appeared if you haven't downloaded dependencies of Laravel.

Try:

composer install

or

composer update

PHP is unable to open Laravel core files. This is usually because of ownership problems.

Issue this command:
ls -l /var/www/mfserver

Chances are you'll see a list like this.

drwxr-xr-x   3 root root   4096 Apr 27 03:58 bootstrap

That's not right. It needs to be owned by the nginx user, typically www-data .

Issue this command to fix it:
chown -R www-data:www-data /var/www/mfserver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM