在 Web 服务器上创建您的第一个 laravel 项目

Creating your first laravel project on web server

我最近刚刚在我的 lamp 服务器上遵循本指南和 "installed" laravel:https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04

现在当我完成时,他们的指南底部会说

"You now have Laravel completely installed and ready to go. You can see the default landing page by visiting your server's domain or IP address in your web browser:

http://server_domain_or_IP"

当我访问我的网站时,没有新的登陆页面,var/www/html 中也没有新文件可以作为登陆页面,除了标准的 apache 文件。

对我来说这很好,但我仍然不知道如何创建我的第一个项目,我想这样做是为了检查我的安装是否完成,我准备睡觉了。

这是我的 www 目录目前的样子:

这是我的 nginx 配置,我相信它在整个过程中发挥了作用:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;
    root /var/www/laravel/public;
    index index.php index.html index.htm;

    server_name www.mysite.me;

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

    location ~ \.php$ {
    try_files $uri /index.php =404;
    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;
}

}

服务器需要重新启动才能使某些设置生效。

您可以尝试访问其控制台并输入

要从命令行重启服务器,运行:

sudo shutdown -r now

要重新启动 Apache,运行:

 sudo service apache2 restart

文件位于 /var/www/laravel 文件夹中,而不是您提供的屏幕截图中可见的 /var/www/html 文件夹中。

根据我自己发生这种情况的经验,这是由于在不同网站的多个 nginx 配置文件中有多个 'default server' 属性,因此当通过 IP 查看服务器时,它不会选择您的新 laravel构建。