您的位置:首页 > 运维架构 > Nginx

安装PHP yii2框架(PHP7.0+mysql+nginx+Ubuntu16.04)

2017-06-07 00:00 956 查看
步骤一:安装PHP7.0

sudoapt-getinstallphp

sudoapt-getinstallphp7.0-mbstring


步骤二:安装composer

curl-sShttp://packagist.cn/composer/installer|php

切换到全局安装文件夹

sudomvcomposer.phar/usr/local/bin/composer

步骤三:安装nginx

sudoapt-getnginx

步骤四:修改php.ini

修改:cgi.fix_pathinfo=0

步骤五:修改nginx配置文件

server{

listen80;

server_namecxj.test.com;

root/data/wwwroot;

indexindex.htmlindex.php;

location~\.php$

{

try_files$uri=404;

fastcgi_passunix:/run/php/php7.0-fpm.sock;

fastcgi_indexindex.php;

fastcgi_paramHTTPSon;

includefastcgi.conf;

}

location~.*\.(ico|gif|jpg|jpeg|png|bmp|swf|js|css)$

{

expires30d;

}

location^~/src{

denyall;

}

location~.*\.(log|sh)$

{

root/data/wwwroot/log;

denyall;

}

}

步骤六:安装yii2

1、安装ComposerAsset插件:

phpcomposer.pharglobalrequire"fxp/composer-asset-plugin:^1.2.0"

2、安装基本的应用程序模板,运行下面的命令:

composercreate-projectyiisoft/yii2-app-basicbasic2.0.9

安装高级的应用程序模板,运行下面的命令:

composercreate-projectyiisoft/yii2-app-advancedadvanced2.0.9
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  PHP7.0+mysql+nginx