Laravel,传说中美丽优雅的框架。
比较高端,之前了解的比较少。
高端的东西多少还得了解点。
一:安装
安装大概有两种方式
1:composer安装(网好的时候进行)
修改 composer 的全局配置文件(推荐方式),然后输入安装命令
composer config -g repo.packagist composer https://packagist.phpcomposer.com // 配置命令
composer create-project --prefer-dist laravel/laravel blog // 安装命令
2:github获取源码
地址:https://github.com/laravel/laravel
这里需要注意一下,github下载的源码是没有核心文件夹vendor的。没有这个目录以及旗下的代码,当前整个项目是运行不起来的。
二:部署nginx
Nginx配置文件:
server {
listen 80;
server_name xxxx.com;#填写你的域名
index index.html index.htm index.php;#默认打开页面
root /xxx/xxx/xxx/xxx/xxx/xxx;#你的index.php路径
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location /
{
#如果是二级目录就用 rewrite ^/文件夹名称/(.*)$ /index.php?s=/$1 last;)
if (!-e $request_filename)
{
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
}
如果一切正常现在在浏览器中打开刚刚配置的域名,会出现如下所示的页面:
5b42c6cf8e05ed02785408b463ab1a5e.png如果你访问显示出的页面是服务器500错误,或者是丢出报错原因,基本上就是缓存目录权限的问题。
修改缓存目录权限命令:
chmod -R 777 /xxx/xxx/xxx/xxx/laravel/storage # 需要将 目录中的xxx换成你自己项目的所在地
至此,laravel框架安装及部署完成。
原文链接:https://guanchao.site/index/article/articledetail.html?artid=WoD710Xod
有好的建议,请在下方输入你的评论。
网友评论