Add MAMP Pro Vhosts with script

2019-08-14 17:01发布

问题:

I am trying to add add Virtual Host to MAMP Pro with a script that I am writing. Much of the documentation out there covers adding vhosts with MAMP (free, not Pro). What I am trying to do is add the vhost, restart MAMP Pro, and move on to the next part of my script.

I've tried editing httpd.conf at ~/Library/Application Support/appsolute/MAMP PRO/httpd.conf, but when MAMP Pro restarts it is overwritten each time despite the comments on ~line 915, which say to add Include files to add functionality.

The closest someone has gotten to getting an answer is here where the answerer suggests editing the plist files that MAMP Pro uses to generate the new config file each time.

回答1:

Edit template: MAMP -> File -> Edit Template -> Apache -> httpd.conf and add line at the bottom of the file (change path iy you need, and create your custom conf file):

Include /Applications/MAMP/conf/apache/extra/myVhosts.conf

Then add what you want in this file...