Last active
August 29, 2015 13:57
-
-
Save hoandang/9507870 to your computer and use it in GitHub Desktop.
Virtual host on ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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