Configurare virtual host in MAMP per Mac
1. Host file
sudo nano -w /etc/hosts
Aggiungere questa riga
127.0.0.1 domain.test
2. httpd.conf
Si trova: Applications/MAMP/conf/apache/httpd.conf
DA:
# Virtual Hosts
# Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
A:
# Virtual Hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
3. httpd-vhosts.conf
si trova: Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
DA:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot “/Applications/MAMP/Library/docs/dummy-host.example.com”
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog “logs/dummy-host.example.com-error_log”
CustomLog “logs/dummy-host.example.com-access_log” common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot “/Applications/MAMP/Library/docs/dummy-host2.example.com” ServerName dummy-host2.example.com
ErrorLog “logs/dummy-host2.example.com-error_log”
CustomLog “logs/dummy-host2.example.com-access_log” common
</VirtualHost>
A:
<VirtualHost *:8888>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost *:8888>
DocumentRoot “/Users/user/Sites/domain”
ServerName domain.test
ServerAlias domain.test
</VirtualHost>
4. Test sul browser
http://domain.test:8888