laravel 环境配置
1> 设置 $PATH 环境变量
#cd
#vi .bash_profile 新增下面内容
PATH=$PATH:/server/app/services/bin
PATH=$PATH:/server/app/services/sbin
2> 安装Composer (安装到全局目录,即:$PATH 环境目录)
#cd /server/app/services/bin
将可执行文件 composer.phar 下载到当前目录
#php -r "readfile('');" | php
现在只需要运行 composer 命令就可以使用 Composer 而不需要输入 php composer.phar。
#mv composer.phar composer
3> 安装Larvael
直接下载一键安装包:
讲下载的一键安装包解压,放到服务器 /server/www_laravel 目录
#chmod -R 777 www_laravel (改变目录的可读性,要不会显示错误)
你要给 storage 目录 777 权限
3> 在 niginx 中 配置Larvael 虚拟主机,参考 nginx.conf
# add by linux_wuliqiang , laravel server
server {
listen 8081;
server_name localhost;
root /server/www_laravel/public;
#charset koi8-r;
charset utf-8;
#access_log logs/host.access.log main;
location / {
try_files $uri $uri/ /index.php?$query_string;
index index.php index.html index.htm;
}
location ~* ^.+\.(jpg|jpeg|gif|png|bmp|htm|html|css|js|flv|ico|swf)(.*)$ {
access_log off;
expires 30d;
break;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /server/app/nginx/html;
}
location ~ \.php$ {
# fastcgi_pass 192.168.1.100:9000;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
# config can download res
location \.(zip|ipa|apk|csv)$ {
access_log off;
root /server/www;
expires 30d;
break;
}
}
4> 重启 nginx
// 启动 nginx
#/server/app/nginx/sbin/nginx
//平滑重启
#/server/app/nginx/sbin/nginx -s reload
//检测配置文件是否正确,重启前必须检测一下
#/server/app/nginx/sbin/nginx -t -c /server/app//nginx/conf/nginx.conf
阅读(1101) | 评论(0) | 转发(0) |