opened image

Installing Yii 2.0

  1. We go to the VestaCP control panel at http://you_ip_adress:8083/
  2. Create a domain in the VestaCP control panel.
  3. We connect to the server via SSH (instructions for connecting using the SSH protocol here) 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
   

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.


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.phpBut 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:


vim /home/admin/conf/web/example.com.nginx.conf and add web in the location shown in the screenshot:

 

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 :)