Ubuntu日记——安装和配置Lavarel项目
2016-10-21 本文已影响67人
饥渴计科极客杰铿
首先要搭建好lnmp环境、不会安装请看Ubuntu日记——在搭建laravel lnmp环境
首先安装好Composer
下载composer.phar
curl -sS https://getcomposer.org/installer | php
将composer.phar移动到/usr/local/bin/composer
mv composer.phar /usr/local/bin/composer
运行composer命令,如果能出现如下界面则说明composer已经安装成功了。
composer
这里写图片描述
为composer添加镜像
composer config -g repo.packagist composer https://packagist.phpcomposer.com
通过 Composer 下载 Laravel 安装器
composer global require "laravel/installer=~1.1"
通过 Composer 的 create-project 命令安装 Laravel
composer create-project laravel/laravel --prefer-dist
给该文件夹权限
chmod -R 777 lavarel/
修改nginx配置
你的nginx的root要改为该lavarel项目的public文件夹里
sudo gedit /etc/nginx/sites-available/default
server {
listen 80;
server_name your_domain.com;
root /home/xjk/php/laravel/public;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
location ~ \.php$ {
try_files $uri =404;
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;
}
}
检查错误
sudo nginxt -t
重启nginx
sudo nginx -s reload