一、Mac下安装
1、安装composer ,easy,下载composer,全局安装
curl -sS https://getcomposer.org/installer | php //下载
mv composer.phar ~/bin/composer //建议学我,在用户名目录下,建bin目录,专门放置自定义命令,比如ndk、repo、composer之类命令
2、加入到环境变量:
sudo vim ~/.bash_profile
export PATH=/Users/liangzhongyuan/bin:$PATH //把bin下所有的命令加进来
export PATH=$PATH:/Users/liang***/.composer/vendor/bin/ //把通过composer安装的所有命令,变成全局命令
source ~/.bash_profile //使环境变量生效 ,新会话窗口才可用哦
3、composer安装laravel
composer global require "laravel/installer=~1.1"
4、laravel命令生成项目
laravel new relations //生成项目
chmod -R 777 storage/ //storage 下面都可写
chmod -R 777 vendor/
二、添加nginx配置
注意目录要定位到项目下的public
server { listen 80; root /Users/liang**/Sites/project/relations/public; index index.php index.html index.htm; server_name localrelations**; location / { try_files $uri $uri/ /index.php?$query_string; } # deny access to .htaccess files, if Apache‘s document root location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }
重启nginx ,mac下 sudo nignx -s reload //或者-s stop,nginx进程过几秒后会自动重启
三、修改hosts
sudo vim /etc/hosts
127.0.0.1 localrelations** //添加本地域名解析
四、打开浏览器访问吧。。。easy
相关链接:
http://docs.phpcomposer.com/00-intro.html //composer官网的安装指导,so easy
http://www.golaravel.com/laravel/docs/5.0/installation/ //laravel中文官网