MAMP Question based on tutorial Scott Haneda

Scott Haneda talklists at newgeo.com
Thu Jul 29 02:57:12 PDT 2010


On Jul 29, 2010, at 1:23 AM, Jasper Frumau wrote:

> Other issue, if I go to localhost/wordpress it should show wordpress, now
> located in /opt/local/www/ but I get a 404. Why do you think that is
> happening?

If you want to serve from /opt/local/www, which is an issue that has been in discussion on MacPorts for a while, then you will have to make adjustments to do so.  I am not sure where it stands as to where files will one day be served from with Apache2.  Right now, Apache2 lives in /opt/local/apache2 (this all assumes no prefix changing), but that hopefully, will one day change.

You are skipping the parts of the MAMP docs for MacPorts, and mine as well, on setting the .conf files.  MacPorts uses AliasMatch to pull it off, and I use Directory, the end result is the same.

I would never want to install PMA or WordPress with MacPorts.  WordPress has an update engine built in, which would completely halt you from ever using MacPorts to update those files again.  PMA will eventually get there too.  PMA is also no harder to install than copying a directory in place.  Probably better for another email thread for that discussion.

If your files reside in /opt/local/www/something then you will need to setup your virtual host settings.  While I am not recommending it (Follow the MacPorts MAMP wiki instead, so people here can help you better), it is covered in the instructions I use for myself under:
 Apache 2 Layout
 Customizing Apache 2 for local development
 Disable User Directories
 Enable the local Apache manual
 Enable virtual hosting

And also at the bottom of the file, bolder heading: 
 Revisiting Virtual Hosts
which covers setting up /etc/hosts for shortcutting to different locations.

This is sort of getting further away from your initial deadline, which was to get MySql running.  The tutorial I wrote was mostly for me, and one day to migrate *into* the MAMP wiki as an update with changes.  I wanted to hold off until the Apache2 layout issues are agreed upon, and after asking around, I agree that Documentation fragmentation sucks. It should be all in one place.  

My methods do not exactly follow how MacPorts has things set up.  But, it is how I like to have things set up.  I also have virtual hosts that serve from ~/Sites and from /opt/local/apache2/htdocs

I further don't want to serve from / at all, as eventually, this all ends up on a server at /Volumes/big-fat-raid, and hopefully, /Volumes/ZFS-system

It serves my purposes for how I want to work (locally), though this is why I was hesitant to post the instructions, as it was only intended to get Mysql running, which does follow the layout of MacPorts exactly.  The rest of it you will be on your own if you continue down the road of mimicking my setup, which while not unusual, will require reading up on the Apache docs.  Not a bad thing to learn to be honest, but there is a bit to pick up and if you are in a hurry, now may not be the best time.

You can find the docs that will help you most by following them throughout the various links.
    http://httpd.apache.org/docs/2.0/vhosts/

> After a restart all was good. Question, www CHMOD/CHOWN rights are now:
> Jaspers-MacBook-Pro:~ jasper$ cd /opt/local/
> Jaspers-MacBook-Pro:local jasper$ ls -l | grep www
> drwxr-xr-x    62 root  admin   2108 Jul 29 12:06 www
> Which is annoying as I cannot easily copy and paste file without using sudo.
> What chmod and chown would you recommend? NB This is for a local development
> server..

Set them to your user/group:
`sudo chown -R you:staff www` where 'you' is your username and 'www' is the path to the directory.  I would probably set the chmod to 755 or so for the permissions. That also depends on the file(s), and what you want to do with them.  It may be easier to just work out of ~/Sites, but it is really up to you and how you want to configure your system.  Mimicking the mask for ~/Sites is not a bad idea, and you will want to set the ACL's appropriately as well.

In some sense, it doesn't matter, and you could 777 the entire set, depending on how you plan on moving your files to your final host.  If you use ftp, they will have a umask that defaults the permissions to something sane.  If the host allows you to ssh the files, depending on how things are set, permissions and masks may be inherited, which would then be something you want to take into consideration.  Or maybe the host has their system sort of chrooted in a way that php can not read outside of your account at all, in which case, permissions are going to matter a heck of a lot less.

> PMA should work now and be located at localhost/phpmyadmin, but when I go
> there, there is a 404.

Look at your logs in /opt/local/apache2/logs, specifically the error_log but also access_log.  You only followed in part the instructions, and skipped all the bits about setting up /etc/hosts and /opt/local/apache2/conf/extra/httpd-vhosts.conf and the rest.

If I were you, I would probably go back to the MacPorts MAMP guide and adjust to that layout.

* I could be wrong in that PMA and WordPress install .conf files to locate them somewhere else besides /opt/local/apache2/htdocs, or at least instructs you to do so.  I have never installed those until just now, to see what happens, and gettext is taking some time, and I am off to bed :)

Good luck with your setup, you are mostly there, the rest is just configuration stuff.
-- 
Scott (* For off-list contact, replace talklists@ with scott@ *)



More information about the macports-users mailing list