A new day… A new website… Part 1

For a very long time I’ve been in need of updating this site. In fact, the world pretty passed me by! I was using Mac OS 10.13 High Sierra, because it was the last OS that fully supported server functions with a GUI. I was too lazy to learn how to do it the @nix way. So it’s time I get off my lazy duff and learn. I have a single server with a static IP hosting 2 or more websites with SSL. Here’s how I accomplished it.

Homebrew or MacPorts

I did some research on Homebrew vs. MacPorts. I’ll admit I’d been using Macports for quite sometime and am familiar with its use. Homebrew, while ubiquitous has some security flaws that I’m not willing to live with. While there are lot’s of instructions on how to setup Apache2/PHP/MySQL with Homebrew, there are not many using MacPorts. So here’s my take on how to set one up.

I wanted to start with a clean slate. I’m using and older MacPro that will run Big Sur. I formatted the internal SSD and installed a clean copy of Big Sur 11.4. After booting up and completing Apple’s setup configuration, I went to the app store and downloaded Xcode, it takes a while, and BBedit. Two utilities that I consider to be essential to my server setup.

I enabled root user and turned on invisible files so I could navigate to the required folders when necessary. (open terminal and enter “defaults write com.apple.finder AppleShowAllFiles YES; killall Finder”) After completing the installation of Xcode I open terminal and installed the command line tools

% sudo xcodebuild -license

Download MacPorts as an installer package and restart your computer.

REFERENCES:

https://www.macports.org/install.php.

https://trac.macports.org/wiki/howto/Apache2

Now open Terminal and download the most current version of Apache2

% sudo port install apache2

Now verify that the supplied version of Apache is NOT running. Open Terminal and enter

% sudo lsof -i:80

If there is no output, apache isn’t running. If you get output enter the following in terminal.

% sudo launchctl unload -w /System/Library/LaunchDaemons org.apache.httpd.list

Which will unload Apple’s apache launchdaemon so you and use the latest version you’ve just downloaded.

%  sudo port load apache2

Will install a new launchdaemon for the latest version Apache2

% /opt/local/sbin/apachectl -t

will verify the configuration of apache is correct.

————————— RESTART YOUR MAC———————–

Open Terminal and enter

% httpd -v

To verify that the correct version of Apache2 is running

(as of this writing, apache 2.4.48)

Open BBEdit and open /opt/local/etc/apache2/httpd.conf (the main configuration file for Apache2

Find the line that starts with

ServerName and change it to 

ServerName localhost:80

————————— RESTART YOUR MAC———————–

Open Terminal

% httpd -v

Should return

Server version: Apache/2.4.48 (Unix)

Server built:   May 26 2021 07:00:18

Load startup items do Apache starts after every reboot or startup

% sudo port load apache2

Let’s verified if this works.

Open Safari

http://localhost

Should return.

Leave a Reply

Close Menu