This is a simple guide for setting up a local apache web server on your Mac OSX machine. You can use this to develop and test your sites locally before uploading to your web host and also for learning web programming.
Step 1: Create the Sites folder in your home directory
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 command after launching the Terminal app:
- An Apache web server, behind a load balancer or proxy server, must produce log records containing the client IP information as the source and destination and not the load balancer or proxy IP information with each event. Apache web server logging capability is critical for accurate forensic analysis.
- MAMP is a Mac utility that helps users install Apache, Nginx, PHP and MySQL on their machine and therefore have a personal web server. The name of the program is an acronym for Macintosh, Apache, MySQL and PHP.
- To further configure Apache web server under MacOS, navigate to the “httpd.conf” file. Sudo nano / etc / apache2 / httpd.conf Like Linux, you can easily restart the Apache service using the apachectl command with root privileges.
The Apache HTTP Server ('httpd') was launched in 1995 and it has been the most popular web server on the Internet since April 1996. It has celebrated its 25th birthday as a project in February 2020. The Apache HTTP Server is a project of The Apache Software Foundation. Apache httpd 2.4.46 Released 2020-08-07 ¶.
Step 2: Create a basic html page for testing your local web server
Step 3: Enable PHP
PHP is not enabled by default in recent versions of OS X. To enable it, type the following at the terminal:
Uncomment the following line:
i.e. it should read as
(if you aren’t familiar with vi, just press ‘x’ over the ‘#’ character to delete it. Then type ‘:wq’ to save and quit.)
You can find this line on the following line numbers depending on your OS.
- 10.7 Lion – line 111
- 10.8 Mountain Lion – line 117
- 10.9 Mavericks – line 118
- 10.10 Yosemite – line 169
- 10.11 El Capitan – line 169
For Yosemite and beyond only, uncomment the following line at line 166:
to
and do the same at line 493:
to
Save and exit (type ESC and :wq and return)
And again, for Yosemite and beyond only, open the file above with:
and uncomment the following line at line 16:
to
Zip it software for mac. No GUI;. Extract files from archives only;.
Save and exit (type ESC and :wq and return)
Step 4: Ensure your user config file exists
Note: For this step and beyond, replace <your short user name> with your short user name. This can be found by typing whoami at the terminal.
Your user config file should exit at the path /etc/apache2/users/.conf.
If that file doesn’t exist, you will need to create it by typing the following at the terminal:
For all OSX versions prior to Yosemite, use the following as the content:
For Yosemite and beyond, use this content:
Save and exit (type ESC and :wq and return)
Step 5: Turn on Apache web server
In Lion, do the following:
To turn on Apache, go to System Preferences > Sharing and enable Web Sharing.
In more recent versions of OS X, the Web Sharing checkbox in System Preferences > Sharing is gone. Instead, type the following in terminal:
Step 6: Test your Web Server
In Safari, navigate to your web site with the following address:
http://127.0.0.1/
It should say:
It works!
Now try your user home directory:
http://127.0.0.1/~<your short user name>
It should show the content of the html file we just created:
My site works
Now test PHP. Create a PHP info file by typing the following in terminal:
Now test it by entering the following into Safari’s address bar:
http://127.0.0.1/~<your short user name>/info.php
You should see your PHP configuration information.
If you want to make further changes to your Apache system or user config files, you will need to restart the Apache server with:
Use the links below to download the Apache HTTP Server from one of ourmirrors. You mustverify the integrity of the downloadedfiles using signatures downloaded from our main distribution directory.The signatures can be verified with ourKEYS file.
Php Web Server Mac
Only current recommended releases are available on the main distributionsite and its mirrors. Historical releases, including the 1.3, 2.0 and 2.2families of releases, are available from the archive download site.
Apache httpd for Microsoft Windows is available froma number of third party vendors.
Stable Release - Latest Version:
- 2.4.46 (released 2020-08-07)
If you are downloading the Win32 distribution, please read these importantnotes.
The currently selected mirror ishttps://www.mirrorservice.org/sites/ftp.apache.org/. If you encounter a problem with this mirror, please selectanother mirror. If all mirrors are failing, there are backup mirrors (atthe end of the mirrors list) that should be available.You may also consult the complete list ofmirrors.
Apache For Mac
The Apache HTTP Server Project is pleased toannounce therelease of version 2.4.46 of the Apache HTTP Server ('Apache' and 'httpd').This version of Apache is our latest GA release of the new generation 2.4.xbranch of Apache HTTPD and represents fifteen years of innovation by theproject, and is recommended over all previous releases!
For details, see the OfficialAnnouncement andthe CHANGES_2.4 andCHANGES_2.4.46 lists.
Source: httpd-2.4.46.tar.bz2[ PGP ] [SHA256 ]
Source: httpd-2.4.46.tar.gz [PGP ] [SHA256 ]
The Apache Software Foundation and the Apache HTTP Server Project arepleased to announce the release of version 2.3.9 of mod_fcgid, a FastCGIimplementation for Apache HTTP Server versions 2.2 and 2.4. Thisversion of mod_fcgid is a security release.
For information about this module subproject, see the mod_fcgid moduleproject page.
Source as gzip with LF line endings:mod_fcgid-2.3.9.tar.gz[PGP] [MD5] [SHA1]
Source as bz2 with LF line endings:mod_fcgid-2.3.9.tar.bz2[PGP] [MD5] [SHA1]
Win32, Netware or OS/2 Source with CR/LF line endings:mod_fcgid-2.3.9-crlf.zip[PGP] [MD5] [SHA1]
The Apache HTTP Server Project is pleased to announce the release of ApacheFTP module for Apache HTTP Server, version 0.9.6 as beta.
Users are encouraged to test and provide feedback on this beta release. Forinformation about this module subproject, see the mod_ftp module projectpage.
Source with LF line endings (bzip2 compressed):mod_ftp-0.9.6-beta.tar.bz2[PGP] [SHA1] [MD5]
Source with LF line endings (gzip compressed):mod_ftp-0.9.6-beta.tar.gz[PGP] [SHA1] [MD5]
Win32, Netware or OS/2 Source with CR/LF line endings:mod_ftp-0.9.6-beta-crlf.zip[PGP] [SHA1] [MD5]
It is essential that you verify the integrity of the downloaded files usingthe PGP or SHA signatures. Please read Verifying Apache HTTP ServerReleases for more information on why you shouldverify our releases and how to do it.