(tested on Ubuntu 14.04 and Apache 2.4.7)
- Go to
/etc/apache2/sites-available
, open terminal and executesudo cp 000-default.conf MySite.conf
. - Open site config
sudo gedit MySite.conf
and change content to:
Listen 8022
<VirtualHost *:8022>
ServerAdmin webmaster@localhost
DocumentRoot /path/to/MySite
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /path/to/MySite>
Require all granted
</Directory>
</VirtualHost>
- Enable site -
sudo a2ensite MySite.conf
(to disable site usesudo a2dissite MySite.conf
) - Restart Apache -
sudo service apache2 restart
Open localhost:8022
in the browser.
If you get 403 error while loading site content files, open terminal in your site folder and execute
sudo chmod -R 755 .
If you get 404 error with "javascript" subfolder, open terminal and run
sudo apt-get remove javascript-common
- Open your site config file (MySite.conf), add line
ServerAlias mysite.com
afterServerAdmin
and change port to80
. - Go to
/etc
, open terminal and executesudo gedit hosts
. - Add line
127.0.0.1 mysite.com
. - Restart Apache.
I would add a TIP: if a white page shows when browsing the site could be you have wrong permissions
e.g. in linux you should run chown to user www-data (apache2 user) the whole site tree
#chown -R www-data:www-data /path/to/MySite