---
title: 'Installing Yii 2.0 | Zomro'
description: 'Before installing the framework, you need to prepare the working environment. This guide will use Centos 7 OS and a pre-installed...'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654764264_yii2.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * Installing Yii 2.0 



# Installing Yii 2.0

07-06-2022

  1. We go to the VestaCP control panel at http://you_ip_adress:8083/
  2. Create a domain in the VestaCP control panel.  
![Installing Yii 2.0 - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1656505712_yii.png)![Installing Yii 2.0 - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654764264_yii2.png)
  3. We connect to the server via SSH (instructions for connecting using the SSH protocol [here](https://zomro.com/rus/blog/faq/142-podkljuchenie-k-serveru-po-ssh)) and go to the site directory:


    
    
    /home/admin/web/example.com/public_html/
    

(where instead of example.com is your site).  
4\. We execute the command:
    
    
    rm -f index.html && rm -f robots.txt

**Installing Yii2 via Composer.**  
1\. Next, install Composer:
    
    
    curl -sS https://getcomposer.org/installer | php
    mv composer.phar /usr/local/bin/composer
    

2\. Now you need to go to the directory of your site, in our case it is:
    
    
    cd /home/admin/web/yiizomro.com/
    

3\. Now install Yii with the following command:
    
    
    composer create-project --prefer-dist yiisoft/yii2-app-basic public_html/ 
    

4\. We agree with all the conditions (enter yes and y twice)  
5\. Next, issue admin rights for the public_html directory
    
    
    chown -R admin:admin /home/admin/web/yiizomro.com/public_html/
    

6\. Then we edit the domain and add a self-signed certificate for a while  
![Installing Yii 2.0 - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654778451_yii5.png)![Installing Yii 2.0 - 4](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654778534_yii6.png)![Installing Yii 2.0 - 5](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654778523_yii7.png)

7\. Now open the browser and in the address bar of the browser enter:  
http://yiizomro.com/web/index.php where instead of yiizomro.com is the name of your site.

  
![Installing Yii 2.0 - 6](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654778631_yii8.png)

Done, Yii2 is installed, if you still don't see the "Congratulations!" then go to the following address and check what is missing for Yii2 to work.  
`http://yiizomro.com/basic/requirements.php`But on the server you will probably want to change the application URL  
from http://example.com/web/index.php to http://yiizomro.com/index.php or just http://yiizomro.com/.  
To do this, you need to edit httpd.conf and nginx.conf as follows:  
vim /home/admin/conf/web/example.com.httpd.conf and add web in the places indicated in the screenshot, and comment the line php_admin_value open_basedir:

  
![Installing Yii 2.0 - 7](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654778657_yii9.png)

vim /home/admin/conf/web/example.com.nginx.conf and add web in the location shown in the screenshot:  
![Installing Yii 2.0 - 8](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a58@server-panel.net/2022/06/01/1654778733_yii10.png)

To save the changes, you need to restart the services:
    
    
    service httpd restart
    service nginx restart

Now your site opens by domain without unnecessary paths, pleasant work :)

Similar articles:

[How to enable sound on VPS with Windows Server 2012, 2016, 2019](https://zomro.com/blog/faq/269-kak-vkljuchit-zvuk-na-vps-s-windows-server-2012-2016-2019) [Upgrading and downgrading PHP on CentOS 7](https://zomro.com/blog/faq/434-upgrading-and-downgrading-php-on-centos-7) [How to grant access to Windows Server by IP or IP range](https://zomro.com/blog/faq/337-kak-ogranichit-dostup-k-windows-server-po-ip) [cPanel: creating a mailbox and working with it](https://zomro.com/blog/faq/222-cpanel-sozdanie-pochtovogo-jaschika-i-rabota-s-nim) [How to create RAID 0 and RAID 1 on G7](https://zomro.com/blog/faq/241-kak-sozdat-raid-0-i-raid-1)

[ Forex Server from €7.95/mon ](/server-for-forex)
