Open Source Webserver For Mac High Sierra

38 26 likes 78,151 views Last modified Nov 13, 2018 10:22 AM

Jan 29, 2018  As for Caching Server, Time Machine Server, and File Sharing advanced options, Apple already moved those into into ordinary macOS - with the arrival of macOS High Sierra. Apache owes its name to the fact that it’s “a patchy” service. These patches are often mods, or modules. Configuring web services is as easy in macOS Server 5.4, running on High Sierra (10.13), as it has ever been. To set up the default web portal, simply open the Server app, click on the Websites service and click on the ON button.

Here is my definitive guide to getting a local web server running on OS X 10.13 “High Sierra”. This is meant to be a development platform so that you can build and test your sites locally, then deploy to an internet server. This User Tip only contains instructions for configuring the Apache server, PHP module, and Perl module. I have another User Tip for installing and configuring MySQL and email servers.


Note: This user tip is specific to macOS 10.13 “High Sierra”. Pay attention to your OS version. There have been significant changes since earlier versions of macOS.

Another note: These instructions apply to the client versions of OS X, not Server. Server does a few specific tricks really well and is a good choice for those. For things like database, web, and mail services, I have found it easier to just setup the client OS version manually.


Requirements:

  1. Basic understanding of Terminal.app and how to run command-line programs.
  2. Basic understanding of web servers.
  3. Basic usage of vi. You can substitute nano if you want.

Optional:

Xcode is required for adding PHP modules.


Lines in bold are what you will have to type in. Lines in bold courier should be typed at the Terminal.

Replace <your short user name> with your short user name.


Here goes.. Enjoy!


To get started, edit the Apache configuration file as root:

sudo vi /etc/apache2/httpd.conf


Enable PHP by uncommenting line 177, changing:

#LoadModule php7_module libexec/apache2/libphp7.so

to

LoadModule php7_module libexec/apache2/libphp7.so

(If you aren't familiar with vi, go to line 177 by typing '176G' (without the quotes). Then just press 'x' over the '#' character to delete it. Then type ':w!' to save, or just 'ZZ' to save and quit. Don't do that yet though. More changes are still needed.)


If you want to run Perl scripts, you will have to do something similar:


Enable Perl by uncommenting line 178, changing:

#LoadModule perl_module libexec/apache2/mod_perl.so

to

LoadModule perl_module libexec/apache2/mod_perl.so


Enable personal websites by uncommenting the following at line 174:

#LoadModule userdir_module libexec/apache2/mod_userdir.so

to

LoadModule userdir_module libexec/apache2/mod_userdir.so


and do the same at line 511:

#Include /private/etc/apache2/extra/httpd-userdir.conf

to

Include /private/etc/apache2/extra/httpd-userdir.conf

Now save and quit.


Open the file You just enabled above with:

sudo vi /etc/apache2/extra/httpd-userdir.conf

and uncomment the following at line 16:

#Include /private/etc/apache2/users/*.conf

to

Include /private/etc/apache2/users/*.conf

Save and exit.


Lion and later versions no longer create personal web sites by default. If you already had a Sites folder in Snow Leopard, it should still be there. To create one manually, enter the following:

mkdir ~/Sites

echo '<html><body><h1>My site works</h1></body></html>' > ~/Sites/index.html.en


Nero for OS X/macOS Nero for Mac is fully compatible with Mac OS X 10.4(Tiger), 10.5(Leopard), 10.6(Snow Leopard), 10.7(OS X Lion), 10.8(OS X Mountain Lion), 10.9(OS X Mavericks), 10.10(Yosemite), 10.11(EL Capitan), macOS 10.12 Sierra, 10.13 macOS High Sierra, 10.14 macOS Mojave. Nero for mac os x yosemite. Unfortunately, not for Mac users. Nero is NOT compatible with any Mac OS X, from Mac OS X 10.5 to the latest Mac OS X 10.8 Mountain Lion. You have to find a Nero for Mac alternative that has the features you're familiar with. We do a lot of work to find the best alternative application so you don't have to. Oct 24, 2019  Mac mini introduced in early 2009 or later iMac introduced in mid 2007 or later Mac Pro introduced in early 2008 or later Xserve models introduced in early 2009. To find your Mac model, memory, storage space, and macOS version, choose About This Mac from the Apple menu. If your Mac isn't compatible with OS X Yosemite, the installer will let.

While you are in /etc/apache2, double-check to make sure you have a user config file. It should exist at the path: /etc/apache2/users/<your short user name>.conf. That file may not exist and if you upgrade from an older version, you may still not have it. It does appear to be created when you create a new user. If that file doesn't exist, you will need to create it with:


sudo vi /etc/apache2/users/<your short user name>.conf


Use the following as the content:

<Directory '/Users/<your short user name>/Sites/'>

AddLanguage en .en

AddHandler perl-script .pl

PerlHandler ModPerl::Registry

Options Indexes MultiViews FollowSymLinks ExecCGI

AllowOverride None

Require host localhost

</Directory>


Now you are ready to turn on Apache itself. But first, do a sanity check. Sometimes copying and pasting from an internet forum can insert invisible, invalid characters into config files. Check your configuration by running the following command in the Terminal:

apachectl configtest


If this command returns 'Syntax OK' then you are ready to go. It may also print a warning saying 'httpd: Could not reliably determine the server's fully qualified domain name'. You could fix this by setting the ServerName directive in /etc/apache2/httpd.conf and adding a matching entry into /etc/hosts. But for a development server, you don't need to do anything. You can just ignore that warning. You can safely ignore other warnings too.


Turn on the Apache httpd service by running the following command in the Terminal:

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist


Open Source Webserver For Mac High Sierra Mac

In Safari, navigate to your web site with the following address:

http://localhost/


What is the lastest os x for g5 Locate the biggest files on your computer:Go to Finder All My Files Arrange by sizeThen you can move your space hoggers onto an external drive or a cloud storage.If you aren’t comfortable with cleaning the Mac manually, there are some nice automatic “room cleaners”.

It should say:


It works!

Open Source Web Server For Mac High Sierra Patcher


Now try your user home directory:

http://localhost/~<your short user name>


It should say:


My site works


Now try PHP. Create a PHP info file with:

echo '<?php echo phpinfo(); ?>' > ~/Sites/info.php


And test it by entering the following into Safari's address bar:

http://localhost/~<your short user name>/info.php


You should see your PHP configuration information.


To test Perl, try something similar. Create a Perl test file with:

echo 'print $ENV{MOD_PERL} . qq{n};' > ~/Sites/info.pl


Webserver

And test it by entering the following into Safari's address bar:

http://localhost/~<your short user name>/info.pl

You should see the string 'mod_perl/2.0.9'.


Open Source Web Server For Mac High Sierra Os

If you want to setup MySQL, see my User Tip on Installing MySQL.


If you want to add modules to PHP, I suggest the following site. I can't explain it any better.

Open Source Web Server For Mac High Sierra Update


Open Source Webserver For Mac High Sierra Download

If you want to make further changes to your Apache system or user config files, you will need to restart the Apache server with:

Open Source Web Server For Mac High Sierra 10 13

sudo apachectl graceful