You could change the Listen port and the ServerName in nf as you could find in the following post: I tried to set up my last virtual hosts, but MAMP’s 8888 port number was avoid the regular work.įinally I found the solution. Recently I changed from XAMP to MAMP on MAC. dev domain ending after 2017, although it didn’t work in Firefox or Safari for me either. The post mentions this, but then continues using. This line didn’t already exist in my nf file, I had to add it: Include /Applications/MAMP/conf/apache/extra/nf.I followed this post, as recommended by szatti1489, and it worked for me: Ī couple of points are worth mentioning though: Now, my 3 virtual hosts are working ! Solution no. In my config in MAMP, only the first virtual host was responding.Īfter hours of search I founded the instruction for solving the problem (before listing virtual hosts definitions) : NameVirtualHost *:80 If the url is showing error in chrome try safari Open terminal and type sudo pico /etc/hosts
#Mamp pro virtual hosts code#
Go to Applications > MAMP > conf > apache > extra > nfĪdd the virtual host with servname and document root like the below code Īllow your computer to recognize your local domain # Virtual hostsįind this line in that same nf file. Uncomment the code by removing the hash symbol. #Include /Applications/MAMP/conf/apache/extra/nf Go to Applications > MAMP > conf > apache > nf You should now be able to access the virtual host with the following URL. Save all the files you have edited, and restart the servers in the MAMP control panel. If you want to create more than one virtual host, copy one of the definitions, and edit it accordingly. If you want to store the files in a different location, adjust the value of DocumentRoot accordingly.
#Mamp pro virtual hosts mac#
Replace “username” in the second definition with your own Mac username. This assumes that you want to locate the files for mysite in your Sites folder. To add a virtual host for mysite, the edited definitions should look like this:ĭocumentRoot "/Users/username/Sites/mysite" Only the DocumentRoot and ServerName directives are required. Edit the second one for the virtual host you want to add. Virtual hosts override the existing localhost, so the first one needs to re-establish localhost. ServerAlias ErrorLog "logs/-error_log"ĬustomLog "logs/-access_log" commonĭocumentRoot "/Applications/MAMP/Library/docs/"ĮrrorLog "logs/-error_log"ĬustomLog "logs/-access_log" commonĮdit both examples. They look like this:ĭocumentRoot "/Applications/MAMP/Library/docs/"
#Mamp pro virtual hosts how to#
At the bottom of the page are two examples of how to define virtual hosts in Apache.This is where you define the virtual hosts. Save the file, and then open Applications/MAMP/conf/apache/extra/nf.
![mamp pro virtual hosts mamp pro virtual hosts](https://documentation.mamp.info/en/MAMP-PRO-Mac/Settings/Hosts/General/General-Resolution-MAMP-Viewer.png)
Include /Applications/MAMP/conf/apache/extra/nf Remove the hash (pound) sign from the beginning of the line that begins with Include # Virtual Hosts # Include /Applications/MAMP/conf/apache/extra/nf
![mamp pro virtual hosts mamp pro virtual hosts](https://venturebeat.com/wp-content/uploads/2018/11/IMG_2666.jpeg)
Press ESC, then :wq! to overwrite and close the file. This opens a system file that contains the following line: 127.0.0.1 localhostĪdd your desired host name after local host: 127.0.0.1 localhost mysite.loc Open your console in mac and edit your hosts file like this While googling, I found these steps to easily create virtual hosts on MAMP: Do not change this entry.īut what to do next? How to solve this problem? Solution no. # localhost is used to configure the loopback interface I have created a hosts entry like below :
![mamp pro virtual hosts mamp pro virtual hosts](https://documentation.mamp.info/en/MAMP-PRO-Windows/Settings/Hosts/General/OpenHost.png)
I know how to create virtual hosts in Ubuntu but have no idea about Mac. I am new to Mac but used Ubuntu for development for a long time.