macOS Mojave breaks your local websites

posted in: Uncategorized | 4

One of the joys of working on a real operating system like my MacBook means that I can run test websites locally.  apache2 runs right out of the box.  Almost. Not really.

Firstly, I can never remember that Macs have the web root directory at /Library/WebServer/Documents/ so I always make a symbolic link of /var/www to it.

lrwxr-xr-x 1 root wheel 29 Nov 4 2016 /var/www -> /Library/WebServer/Documents/

Keeps me from having to remember Mac special stuff.  I don’t moving it literally is good though.  apparmor. OS updates getting upset because you made something different than their test environment.

One of the bad things I find is that any time you update the OS it crushes your httpd.conf file so now all of your local sites are broken. You’ll need to re-apply all of those changes it commented out.  As a favor. Invariably I try to reconstruct all of the things that got reset and these are the bits I end of changing back.  Plus enabling PHP if that has been disabled.  These lines are not next to each other but you get the idea.

< #Include /private/etc/apache2/extra/httpd-userdir.conf
< #ServerName www.example.com:80
< Options FollowSymLinks Multiviews
< AllowOverride None

> Include /private/etc/apache2/extra/httpd-userdir.conf
> ServerName localhost
> Options FollowSymLinks Multiviews Indexes
> AllowOverride All

You may not need all of these. Look them up. Decide.

It may have crushed your /etc/apache2/users/yourusername.conf fix that too.

Lastly I have never gotten http://localhost/~josh to work so I just symlink things instead

lrwxr-xr-x 1 root wheel 29 Nov 7 16:39 db -> /Users/josh/Sites/phpmyadmin/

and then http://localhost/db  works for me!  And if that doesn’t work then you can just do things like

python -m SimpleHTTPServer 8000

to make the current directory a testable web server.

 

4 Responses

  1. hd porn xvideos

    I’d like to thank you for the efforts you’ve put in penning this website.
    I’m hoping to see the same high-grade blog posts by you later
    on as well. In truth, your creative writing abilities has
    encouraged me to get my very own website now 😉

Leave a Reply to hd porn xvideos Cancel reply

Your email address will not be published. Required fields are marked *