composer 安装 Laravel 5.5

教程 shanhuhai 27736℃ 0评论

让我们来安装最新版的 Laravel 5.5。
使用 composer 安装 Laravel 5.5 之前,你需要先安装compser

安装

假设你要做一个博客的项目,打开命令行执行

composer create-project  --prefer-dist  laravel/laravel=5.5.*  blog

blog 是你的项目目录,安装完成后所有的文件都会在这个目录中。

安装好后目录结构如下:

Laravel5.5 目录结构

配置

安装好后配置 nginx, 下面是一个范例

server {
    listen  80;    
    server_name laravel.loc;
    index index.php;
    root /data/blog/public;

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

    location ~ \.php$ {
        trim on;
        fastcgi_pass  127.0.0.1:9001;
        fastcgi_index index.php;
        include fastcgi.conf;
    }
}

其中 root 指令配置的目录对应项目目录下的public 目录,根据你安装的实际路径来修改。
location 指令将所有的请求转发到了项目的入口文件public/index.php 上。

重启nginx。

Laravel5.5 默认页

如果你的域名已经绑定了hosts,直接在浏览器打开可以看到:

Laravel5.5 欢迎页

转载请注明:大后端 » composer 安装 Laravel 5.5

付费咨询
喜欢 (33)or分享 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址