- Run this command in terminal:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/site.dev.conf
- Open that file in your favourite editor:
sudo vi /etc/apache2/sites-available/site.dev.conf
- Edit that file, for example:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName site.dev
DocumentRoot /var/www/html/site/public
<Directory "/var/www/html/site/public">
AllowOverride all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- Edit your host file:
sudo vi /etc/hosts
- add this line at the end of file:
127.0.0.1 site.dev
For example:
127.0.0.1 localhost
127.0.1.1 mint
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 site.dev
- Run this command in terminal:
sudo a2ensite site.dev
- Reload apache with this command:
sudo service apache2 reload
- Navigate to
http://site.dev
in your web browser.