无法在Digitalocean nginx上进行Depoly laravel

时间:2016-12-12 09:01:59

标签: laravel nginx digital-ocean

所以我按照this instruction一步一步将我的laravel项目部署到digitalocean中,但是我没有创建一个新的laravel项目,而是从gitlab克隆了我自己的项目

最后我打开了我的网站,我得到了默认的html页面

  

请通过SSH登录您的Droplet以配置您的LEMP安装。

这是我的nginx文件:

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

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

    # Make site accessible from http://localhost/
    server_name 162.243.39.12;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ /index.php?$query_string;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }
    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;
    }
}

2 个答案:

答案 0 :(得分:1)

所以我联系了digitalocean,他们告诉我要编辑/etc/nginx/sites-enabled/digitalocean而不是/etc/nginx/sites-available/default

p.s:确保你的laravel文件夹中也有.env文件

答案 1 :(得分:0)

不了解您的示例,但here您可以找到LEMP堆栈的精彩教程。确保将字符串root /var/www/html;更改为root /var/www/your_project/public;

location / {
    try_files $uri $uri/ =404;
}

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

/etc/nginx/sites-available/default档案中。