Skip to content

Instantly share code, notes, and snippets.

@pedrorvidal
Last active August 1, 2020 13:30
Show Gist options
  • Save pedrorvidal/f557e06f3c5ab32d8097ef9bf5b393fb to your computer and use it in GitHub Desktop.
Save pedrorvidal/f557e06f3c5ab32d8097ef9bf5b393fb to your computer and use it in GitHub Desktop.
Virtual Hosts Ubuntu + Apache2
# sudo vim /etc/apache2/sites-available/exemplo.local.com.conf
<VirtualHost *:80>
ServerName exemplo.local.com
DocumentRoot /var/www/html/exemplo
<Directory /var/www/html/exemplo>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# sudo gedit /etc/hosts
# 127.0.0.1 exemplo.local.com
# sudo a2ensite exemplo.local.com.conf
# sudo service apache2 reload
# sudo service apache2 restart
# Lembrar de habilitar o mod_rewrite caso esteja desabilitado no apache
# sudo a2enmod rewrite
# Lembrar de colocar todas as permissões de escrita nas pastas de logs e temporários,
# caso contrário dá erro 500 no acesso ao site todo.
# Fonte: http://gilbertoalbino.com/linux-criar-virtual-host-no-ubuntu/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment