ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Ubuntu 安装yii2 advanced版 遇到的坑

2021-04-13 16:05:04  阅读:267  来源: 互联网

标签:files php log yii fastcgi location Ubuntu yii2 advanced


1.安装 Composer

https://www.yiichina.com/doc/guide/2.0/start-installation
通过 Composer 安装

curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer


解决方案

sudo vim /etc/php/7.2/cli/php.ini zlib.output_compression = ON


安装成功

2.安装yii2 高级版

安装yii2

composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application

报错:

更换源:

composer config repo.packagist composer https://packagist.phpcomposer.com

报错:

加参数-g global

composer config -g  repo.packagist composer https://packagist.phpcomposer.com


再次安装yii2

composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application

更改网络连接方式,桥接方式

安装php-mbstring

sudo apt-get install php-mbstring

报网络连接超时

在浏览器打开安装包地址
http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.2/php7.2-mbstring_7.2.9-1+ubuntu16.04.1+deb.sury.org+1_amd64.deb
不能访问,
发现另外一个复制的虚拟机也打开了,怀疑是IP地址冲突,关掉另外一台虚拟机后,可以打开这个地址


再次安装,报错:

composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application

执行:sudo apt-get install phpunitsudo apt-get install php7.2-xml

再次安装,安装成功

composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application



3.配置nginx

sudo vim /etc/nginx/sites-available/default

server {
        charset utf-8;
        client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name frontend.test; root /home/jay/yii-application/frontend/web/; index index.php; access_log /home/jay/yii-application/log/frontend-access.log; error_log /home/jay/yii-application/log/frontend-error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php$is_args$args; } # uncomment to avoid processing of calls to non-existing static files by Yii #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { # try_files $uri =404; #} #error_page 404 /404.html; # deny accessing php files for the /assets directory location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri =404; } location ~* /\. { deny all; } } server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name backend.test; root /home/jay/yii-application/backend/web/; index index.php; access_log /home/jay/yii-application/log/backend-access.log; error_log /home/jay/yii-application/log/backend-error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php$is_args$args; } # uncomment to avoid processing of calls to non-existing static files by Yii #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { # try_files $uri =404; #} #error_page 404 /404.html; # deny accessing php files for the /assets directory location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri =404; } location ~

标签:files,php,log,yii,fastcgi,location,Ubuntu,yii2,advanced
来源: https://blog.51cto.com/u_7605937/2703499

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有