简体   繁体   English

Urantu LEMP堆栈中的Laravel 502坏网关

[英]Laravel 502 bad gateway in Ubuntu LEMP stack

I can't access my laravel project 我无法访问我的laravel项目

My laravel project in /var/www 我在/ var / www中的laravel项目

And i updated nginx in this way: 我用这种方式更新了nginx:

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

    root /var/www/laravel/public;

    index index.php  index.html index.htm;

    server_name dev-localserve.co;

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

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;

            fastcgi_pass 127.0.0.1:9000;
    }

    location ~ /\.ht {
            deny all;
    }
}

How can i fix this problem ? 我该如何解决这个问题?

Since it's Ubuntu repository, I believe you have www-data user. 由于它是Ubuntu存储库,我相信你有www-data用户。 Run these 2 commands: 运行以下两个命令:

// For setting ownership
chown -R www-data:www-data /var/www/laravel

// For setting permissions
chmod 775 -R /var/www/laravel

Also, I think your nginx configs may need a bit more: 另外,我认为你的nginx配置可能还需要更多:

location ~ \.php$ { 
       try_files $uri =404;
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_pass unix:/run/php/php7.2-fpm.sock;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
       #fastcgi_read_timeout 1800; // this line maybe
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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