Implementation process of installing LNMP environment based on OneInStack on Alibaba Cloud ECS CentOS 7 and running Yii2 advanced application template
1. The first connection is selected, as shown in Figure 1:
2. Due to the instance type: I/O optimization, disk type: SSD cloud disk, so refer to the URL:https://help.aliyun.com/knowledge_detail/6689611.html
3. The download link of auto_fdisk_ssd.sh, as shown in Figure 2:
http://aliyun_portal_storage.oss-cn-hangzhou.aliyuncs.com/help%2Fecs%2Fauto_fdisk_ssd.zip?spm=5176.776689611.0.0.DmH9za&file=help%2Fecs%2Fauto_fdisk_ssd.zip
4. Download tool: auto_fdisk_ssd.sh, after pasting the download link, you need to modify it, as shown in Figure 3:
wgethttp://aliyun_portal_storage.oss-cn-hangzhou.aliyuncs.com/help/ecs/auto_fdisk_ssd.zip
5. Unzip auto_fdisk_ssd.zip, as shown in Figure 4:
unzip auto_fdisk_ssd.zip
6. Automatically detect whether there are data disks that have not been partitioned, format the new data disk and automatically mount, and execute the command, as shown in Figure 5 and 6:
bash auto_fdisk_ssd.sh

Automatically detect whether there are data disks that have not been partitioned, format the new data disk and automatically mount
7. Execute the command, refer to the URL:http://oneinstack.com/install/, as shown in Figure 7:
yum -y install wget screen python #for centos/redhat
8. Execute the command, as shown in Figure 8:
wgethttp://aliyun-oss.linuxeye.com/oneinstack-full.tar.gz #Aliyun user download
9. Execute the command, as shown in Figure 9:
tar xzf oneinstack-full.tar.gz
10. Modify the options.conf file and replace all /data/ with /aldata1/, as shown in Figure 10:
cd oneinstack #If you need to modify the directory (installation, data storage, nginx log), please modify the options.conf file
vim options.conf
11. Execute the command and finally restart, as shown in Figure 11 and 12:
./install.sh #Note: Please do not sh install.sh or bash install.sh to execute like this
12. Open the IP address, as shown in Figure 13:
13. Add a virtual host, as shown in Figure 14:
14. Edit the /usr/local/nginx/conf/vhost/service.ygt.cm.conf file, as shown in Figure 15:
15. Add an FTP account, as shown in Figure 16:
./pureftpd_vhost.sh
16. Use FlashFXP to connect to FTP, and the uploading program is completed, as shown in Figure 17:
17. Edit the /usr/local/nginx/conf/vhost/service.ygt.cm.conf file, as shown in Figure 18:
service nginx restart
service php-rpm restart
18. Open the URL:http://service.ygt.cm, as shown in Figure 19:
19. Edit service.ygt.cm/www/config/main-local.php to enable URL optimization, as shown in Figure 20:
20. Open the URL:http://service.ygt.cm/site/about, which returns 404 not found, as shown in Figure 21:
21. Edit the /usr/local/nginx/conf/rewrite/other.conf file, as shown in Figure 22:
Reference URL:http://www.yiiframework.com/doc-2.0/guide-start-installation.html
vim other.conf
location / {
# If you can’t find a real file, distribute the request to index.php
try_files $uri $uri/ /index.php?$args;
}
22. Open the URL:http://service.ygt.cm/site/about, as shown in Figure 23:
23. Check whether the current PHP environment meets Yii The most basic requirements, copy requirements.php to service.ygt.cm/www/web/requirements.php, and edit, as shown in Figure 24:
$frameworkPath = dirname(__file__) ./../../vendor/yiisoft/yii2;
24. Open the URL:http://service.ygt.cm/requirements.php, found that the FileInfo extension is not installed, as shown in Figure 25:
25. Reference URL:http://oneinstack.com/question/oneinstack-how-to-support-the-fileinfo/, compile and install FileInfo, as shown in Figure 26:
26. Open the URL:http://service.ygt.cm/requirements.php, found that the FileInfo extension is installed, as shown in Figure 27:
27. Install the redis extension, as shown in Figure 28:
cd /usr/local/php/bin/
./PECL install redis
# load fileinfo
echoextension=redis.so> /usr/local/php/etc/php.d/ext-redis.ini
service php-fpm restart
28. Check phpinfo() and find that the redis extension has been installed, as shown in Figure 29:
29. Configure php.ini, let the session storage support redis, as shown in Figure 30:
vim /usr/local/php/etc/php.ini
; session.save_handler = files
session.save_handler = redis
; session.hash_function = 0
session.hash_function = “SHA512”
session.save_path = “”
Finally restart the ECS;
30. Security settings, all the files under /aldata1/wwwroot/default are renamed, or deleted, as shown in Figure 31:






























