Created
June 28, 2012 21:46
-
-
Save jbottigliero/3014151 to your computer and use it in GitHub Desktop.
MAMP : Virtual Hosts
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
# Backup your host file | |
sudo cp /etc/hosts /etc/hosts.bak | |
# Edit your host file | |
# See 'hosts.example' for example contents | |
vim /etc/hosts | |
# Edit MAMP Apache configuration to include Virtual Hosts configuration | |
# See 'httpd.conf.example' for contents changes | |
vim /Applications/MAMP/conf/apache/httpd.conf | |
# Edit MAMP Virtual Hosts configuration | |
# See '/httpd-vhosts.conf.example' for changes | |
vim /Application/MAMP/conf/apache/extras/httpd-vhosts.conf | |
# Restart MAMP! |
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
# To make the new virtual host accessible to an internal Virtual Box | |
# Update the hosts file (Windows) | |
{system}/system32/drivers/etc/hosts | |
# EXAMPLE | |
10.0.2.2 example | |
# Access in browser using | |
http://example:8888/ |
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
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost | |
fe80::1%lo0 localhost | |
127.0.0.1 example |
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
# Make sure the following line is uncommented: | |
NameVirtualHost * | |
# Add your Virtual Hosts | |
<VirtualHost *> | |
DocumentRoot "/Applications/MAMP/htdocs/" | |
ServerName localhost | |
</VirtualHost> | |
<VirtualHost *> | |
DocumentRoot "/Applications/MAMP/htdocs/example/" | |
ServerName example | |
</VirtualHost> |
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
... | |
# At ~524 uncomment the following line: | |
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf | |
# If using .htaccess files you'll want to AllowOveride in your DocumentRoot Directory, the following starts line ~212. | |
# The only value you'll need to change is actually around line | |
... | |
<Directory "/Applications/MAMP/htdocs/"> | |
# | |
# Possible values for the Options directive are "None", "All", | |
# or any combination of: | |
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews | |
# | |
# Note that "MultiViews" must be named *explicitly* --- "Options All" | |
# doesn't give it to you. | |
# | |
# The Options directive is both complicated and important. Please see | |
# http://httpd.apache.org/docs/2.2/mod/core.html#options | |
# for more information. | |
# | |
Options All | |
# | |
# AllowOverride controls what directives may be placed in .htaccess files. | |
# It can be "All", "None", or any combination of the keywords: | |
# Options FileInfo AuthConfig Limit | |
# | |
AllowOverride All |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment