a2ensite error "Site not exist" when creating virtualhost apache2 on ubuntu
I have created files for my site in the /home/junda/www/ directory. I use symfony2, means the public files goes to /home/junda/www/symfony2-tries/web/ directory.
I then type this following command to the terminal to change permission:
sudo chmod -R a+rX ~/www
sudo chmod a+rx ~
I also create /etc/apache2/sites-available/symfony2-tries.com file with following content:
# domain: symfony2-tries.com
# public: /home/junda/www/symfony2-tries.com/
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin [email protected]
ServerName www.symfony2-tries.com
ServerAlias symfony2-tries.com
# Index file and Document Root (where the public files are located)
DirectoryIndex app.php
DocumentRoot /home/junda/www/symfony2-tries/web
# Custom log file locations
LogLevel warn
ErrorLog /home/junda/www/symfony2-tries/log/error.log
CustomLog /home/junda/www/symfony2-tries/log/access.log combined
</VirtualHost>
after that i tried to enable it using a2ensite.
sudo a2ensite symfony2-tries
but it returns:
ERROR: Site symfony2-tries.com does not exist!
Could anyone kindly told me where I did wrong? And if possible, how to correct it. Thank You very much.
I have found the solution!
All files in /etc/apache2/sites-available/
must have the .conf
extension now.
Example: symfony2-tries
rename it in symfony2-tries.conf
Type sudo a2ensite symfony2-tries.conf
and restart apache.