Skip to content

Instantly share code, notes, and snippets.

@herusdianto
Last active January 29, 2025 06:52
Show Gist options
  • Save herusdianto/c6fb36064e7a17a451d1 to your computer and use it in GitHub Desktop.
Save herusdianto/c6fb36064e7a17a451d1 to your computer and use it in GitHub Desktop.
Create Laravel Virtual Host In Linux Mint
  1. Run this command in terminal:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/site.dev.conf
  1. Open that file in your favourite editor:
sudo vi /etc/apache2/sites-available/site.dev.conf
  1. 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>
  1. Edit your host file:
sudo vi /etc/hosts
  1. 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
  1. Run this command in terminal:
sudo a2ensite site.dev
  1. Reload apache with this command:
sudo service apache2 reload
  1. Navigate to http://site.dev in your web browser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment