Skip to content

Instantly share code, notes, and snippets.

@hoandang
Last active August 29, 2015 13:57
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 hoandang/9507870 to your computer and use it in GitHub Desktop.
Save hoandang/9507870 to your computer and use it in GitHub Desktop.
Virtual host on ubuntu
alias apache-restart="sudo /etc/init.d/apache2 restart"
alias apache-start="sudo /etc/init.d/apache2 start"
alias apache-stop="sudo /etc/init.d/apache2 stop"
# cp any template.conf from this dir (new site must have .conf extension)
alias vhost="cd /etc/apache2/sites-available"
# <VirtualHost *>
# ServerName foo.dev
# DocumentRoot /home/hoan/www/
# </VirtualHost>
## Edit /etc/apache2/apache2.conf (change /var/www/)
# <Directory /home/hoan/www/>
# Options Indexes FollowSymLinks
# AllowOverride All
# Require all granted
# </Directory>
# issue command: chown -R $USER:$USER /var/www
# chmod -R 775 /home/hoan/www
# edit file /etc/hosts
alias en-site="sudo a2ensite"
alias dis-site="sudo a2dissite"
vim /etc/apache2/envvars # change export APACHE_RUN_USER=hoan, export APACHE_RUN_GROUP=hoan
# Enable mod_rewrite for website forwarding feature (such as auto redirect from root to public folder in laravel)
sudo a2enmod rewrite
Add these lines to config file
<Directory /home/hoan/www/groupdiner/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment