Skip to content

Instantly share code, notes, and snippets.

@jaynarayan89
Created March 8, 2019 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaynarayan89/ffd123f4b924e927197fe8d8b822bc84 to your computer and use it in GitHub Desktop.
Save jaynarayan89/ffd123f4b924e927197fe8d8b822bc84 to your computer and use it in GitHub Desktop.
lamp virtual host
sudo mkdir -p ~/Documents/projects/NEW-SITE-NAME.loc/public_html
sudo touch /etc/apache2/sites-available/NEW-SITE-NAME.loc.conf
sudo gedit /etc/apache2/sites-available/NEW-SITE-NAME.loc.conf
put the following content in file and save.
--------------------------------------------
<VirtualHost *:80>
ServerAdmin admin@NEW-SITE-NAME.loc
ServerName NEW-SITE-NAME.loc
ServerAlias www.NEW-SITE-NAME.loc
DocumentRoot /home/jay/Documents/projects/NEW-SITE-NAME.loc/public_html
<Directory /home/jay/Documents/projects/NEW-SITE-NAME.loc/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
--------------------------------------------
sudo a2ensite NEW-SITE-NAME.loc.conf
sudo service apache2 restart
sudo gedit /etc/hosts
--------------------------------------------
in case eny errors
apachectl configtest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment