Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

todsu168

macrumors newbie
Original poster
Dec 18, 2009
2
0
hi i am a total newbie to mamp pro. i posted a thread on mamp.info and haven't received any replies yet and read in a thread that macrumors forum is more active. so i am giving it a go here. anyway, i have downloaded the 14 day trial version but after reading the mamp forum and user manual i still can't do it. i want to create a virtual host where i can access a site i am developing from two computers (imac and macbook). i also want to be able to work on the site even when i am not at home (accessing the site via the internet using my macbook). could someone kindly show me how to do this?

i have a site, say, abc.com and the files are stored in an external network hdd (buffalo linkstation) under a folder called "abc" (mamp pro doesn't seem to let me select a folder from external hdd as the disk location under host tab).
using mamp (not mamp pro), i can access my site at localhost:8888/abc from my imac but i can't access this site with my macbook because the db is saved in my imac. can this db file be saved outside of application/mamp/db? for example save it in my external network hdd under a "db" folder?

basically, i want to achieve the below with mamp pro:

1) access websites in development using either my macbook or imac.
and
2) make these websites accessible on the internet or locally

right now, i have multiple websites in development using mamp and can only access it using imac. if i can set up mamp pro to do the above, i'll buy the serial number. so hopefully someone can kindly provide step-by-step instructions on the set up before my 14 day trial expires. thank you in advance!!
 
I'll try to explain what I did for this type of setup. I keep my web site files on my flash drive so I can work on it at home or work. Though, I don't transfer database files except for SQLite files so can't address the moving of the db folder without doing a bit of research myself.

In the httpd.conf file at the bottom I have,
Code:
<Directory "/Volumes/mydrive/angelwatt.com">
 Order Deny,Allow
 Allow from all
</Directory>

NameVirtualHost *:80

<VirtualHost *:80>
 DocumentRoot /Volumes/mydrive/angelwatt.com
 ServerName angelwatt.local
 ErrorLog /Volumes/mydrive/logs/apache_error_log
 CustomLog /Volumes/mydrive/logs/access_log combined
 <Directory "/Volumes/mydrive/angelwatt.com">
   AllowOverride All
   Options All Indexes
 </Directory>
</VirtualHost>
Then, in order for the angelwatt.local above to work in a browser I had to add an entry to the /etc/hosts file from Terminal.
Code:
sudo pico /etc/hosts
At the end of the file add a line like,
Code:
127.0.0.1  angelwatt.local
For other machines on your local network, they'll also need to edit the hosts file too, but use the IP address of the iMac where the web server is rather than the localhost IP given above.

As far as accessing the site outside your local network. You'll need to forward port 8080 on your home router to be directed to your iMac. For me, I use port 80, but the default for MAMP is 8080. You can use Google to find directions on how to do port forwarding for your particular router model if you don't already know how. It can vary depending on model so I can direct you on that.

A last note, MAMP (non-Pro) is free so you can switch to that when your time runs out if you don't need the Pro features.
 
want to set up virtual host w/mamp pro to access development site with 2 computers

I'll try to explain what I did for this type of setup. I keep my web site files on my flash drive so I can work on it at home or work. Though, I don't transfer database files except for SQLite files so can't address the moving of the db folder without doing a bit of research myself.

In the httpd.conf file at the bottom I have,
Code:
<Directory "/Volumes/mydrive/angelwatt.com">
 Order Deny,Allow
 Allow from all
</Directory>

NameVirtualHost *:80

<VirtualHost *:80>
 DocumentRoot /Volumes/mydrive/angelwatt.com
 ServerName angelwatt.local
 ErrorLog /Volumes/mydrive/logs/apache_error_log
 CustomLog /Volumes/mydrive/logs/access_log combined
 <Directory "/Volumes/mydrive/angelwatt.com">
   AllowOverride All
   Options All Indexes
 </Directory>
</VirtualHost>
Then, in order for the angelwatt.local above to work in a browser I had to add an entry to the /etc/hosts file from Terminal.
Code:
sudo pico /etc/hosts
At the end of the file add a line like,
Code:
127.0.0.1  angelwatt.local
For other machines on your local network, they'll also need to edit the hosts file too, but use the IP address of the iMac where the web server is rather than the localhost IP given above.

As far as accessing the site outside your local network. You'll need to forward port 8080 on your home router to be directed to your iMac. For me, I use port 80, but the default for MAMP is 8080. You can use Google to find directions on how to do port forwarding for your particular router model if you don't already know how. It can vary depending on model so I can direct you on that.

A last note, MAMP (non-Pro) is free so you can switch to that when your time runs out if you don't need the Pro features.

Thank you for the instructions. I'll try that but I thought if I bought Mamp Pro I wouldn't need to do the above? So there is no need to use Mamp Pro? The port for me is also 80. But I have two questions:

1) in /etc/hosts I have already have
127.0.0.1 localhost
should I change it to 127.0.0.1 mycomputername.local? or add it underneath that line?
2)when you say IP address of the imac where the web server is do you mean my public IP?

Thank you!!
 
hmm it's been a few months since I had to run a similar dilema, when I was needing three computers to talk to a single instance of MAMP. What I did in the end was choose one computer to run MAMP, then turn on that computers 'internet sharing' under the sharing system preference. You can tell the sharing setup that you will be sharing an ethernet connection, or anything, so long as it's not airport, so that you can then share this connection over airport. You'll give the airport channel a name, good idea to give it encryption, and get it started. Once I had done that, after connecting to that airport connection I could connect to the page for viewing with 'mycomputer.local:8080' <-or whatever port you are using for MAMP. And I believe it also worked to FTP to the same address for access to the files remotely where I could do live editing by telling my FTP program to 'edit in Textmate' [or whatever editor you use].

In my case I was only running the computers locally, without any outside internet connection. If you still needed that, then it would be best if you could hardwire with ethernet.. otherwise some tricky solution would be needed to receive and share the airport connection.

As for accessing this whole setup remotely.. I think that will require something like MAMP Pro or another 'desktop computer as server' software...
 
But I have two questions:

1) in /etc/hosts I have already have
127.0.0.1 localhost
should I change it to 127.0.0.1 mycomputername.local? or add it underneath that line?
2)when you say IP address of the imac where the web server is do you mean my public IP?

You'll want to use the local IP of the machine (for other machines on the local network), not the public one. Something like,

Code:
127.0.0.1  localhost
192.168.1.10  nameOfVirtualhost
For the machine running the web server you would do,
Code:
127.0.0.1  localhost
127.0.0.1  nameOfVirtualhost
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.