Is there a definitive guide for setting up Mamp Pr

2019-03-21 00:11发布

问题:

I've been researching how to setup a LAN Mamp Pro server so local users can edit/view sites - but there seems to be a lot of confusion (at least I'm confused based on why I've read).

Specific questions:

Running Apache/Mysql as www/mysql: When I switch the users to www/mysql I see permissions issues and can't login to my CMS from the machine running Mamp Pro. What's the best way of fixing this or running Mamp Pro - taking into consideration permissions when using pushing to DEV and LIVE servers using Git and Github.

Ports: What is more secure, running Mamp Pro using ports 8888/8889 or the defaults of 80/3306? And is the only difference adding/not adding port numbers when viewing sites?

Access to sites by users on the same LAN: What are the steps for getting this working - the firewall on the MAMP Pro machine is currently off to test the basic setup but no one on our local network can connect to the sites - have tried 192.168.0.1:8888 & virtualhostname:8888

Sorry if this is easy but for a paid product, Mamp Pro help and support is pretty scarce and I suspect this stuff is easy if you know how to setup a linux server - but if you don't know how to do this, it's why you purchase MAMP Pro right?

Any help would be much appreciated.

Cheers

Ben

回答1:

Here's what I did:

Setup:

  • I'm developing the site on my local computer

  • Mamp Pro is running on my local computer

  • I would like other people on the local network to login to the CMS on my computer and update the CMS

Server settings:

  • Use the default ports 80/3306 (just don't have web sharing turned on in OSX prefs) - I'm sure you could use the MAMP ports if you want

  • Run Apache/MySQL server as users www/mysql

Virtual host settings:

  • Give your server a name

  • Leave local name resolution on

  • Add the IP address of the computer Mamp Pro is running on e.g. 192.167.1.1

  • Add a port number (this will be the unique way of identifying sites on the LAN - see below for more) I just used port 8888

  • If you had a site setup prior to switching the Apache/MySQL users, click the "Permissions" button under the disk location and set owner to www and the group to admin so your local admin account has access - click "Set"

  • If the above step doesn't work properly, you'll now need to CMD + I the website directory and ensure your local machine admin has rights to read and write to the directory - be sure to click the cog and select "Apply to enclosed items" so the rights get applied to the directories inside

  • Start the virtual host

Accessing the site from another machine on the same LAN:

  • Enter the IP address of the Mamp Pro machine followed by the port number you entered

  • e.g. http://192.168.1.1:8888/

  • If you have multiple sites, just enter a different port number in the setup

This works for me and staff can now edit the CMS and view the site but it seems a bit 'hacky' to me using a different port for each site as the way to differentiate sites in development.

Please sing out if there's abetter way - this is just how I got it working.



回答2:

I have numerous sites set up with MAMP Pro.

To access a specific site, try shuffling it to the top of the list of sites in MAMP Pro, and then access using the IP address and port (as described above),

e.g. http://192.168.1.1:8888/

Geoff



回答3:

I've met the problem "PHP Warning: ...: failed to open stream: Permission denied in /Applications/MAMP/htdocs/Samples/ch17/upload_01.php on line 17". And your suggesting "Virtual host settings" also works for that! Thank you~~



回答4:

"Access to sites by users on the same LAN..."

A more general solution would be to run a proxy server using Squid. SquidMan (http://squidman.net/squidman/) is a nice graphic front-end for setting Squid up, but to do what you want, you shouldn't need to do more than set your local network up under "Clients" and identify the machine it's running on as a proxy in your web server...



回答5:

Others here may have their DHCP setup beginning 192.168... but my Comcast setup actually defaulted to 10.0.0... which is what was causing me so much grief because MAMP doesn't like zeros in the host IP address. You need to go into your router and change the default gateway to something else. Then you will be able to access each of your hosted sites by specifying a port number.



回答6:

If you want to access your mamp websites across lan with there respective domain names not the ip address or ports, you can do this by simply editing the hosts file on your mac.

Or use a tool like https://www.macupdate.com/app/mac/40003/hosts

Point all your domains to the IP of the MAMP host computer, and put the mamp web service on port 80.

use www.domain.dev or similar for the domain names.