If I open my Yii2 application with url http://IP_ADDRESS/DIR_NAME the it works perfectly. Now I have pointed my domain to path /var/www/html/. But if I open my domain in browser it displays my directory structure of yii2 project. So with http://IP_ADDRESS/DIR_NAME I could access my app but not with domain name. Apache rewrite is enabled for /var/www/html/ in 000-default.conf.
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
-Content of 000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
-Content of domain.com.conf
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/domain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>