- httpd.conf.default — Apache server configuration. Instruct how the HTTP server should operate globally.
-
Install Homebrew.
-
Execute
brew install httpd
. -
Execute
sudo apachectl stop
. -
Check localhost and localhost on port 8080 in your web browser to confirm that there are no running Apache processes. The page should not return a response.
-
Execute
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
to prevent the default Apache process from starting with the system. -
Execute
brew install [email protected]
.- Other versions of php can be installed and unlinked/linked as needed. For example:
brew unlink [email protected]
thenbrew link [email protected]
to switch from PHP 7.4 to 7.3.
- Other versions of php can be installed and unlinked/linked as needed. For example:
-
Copy and rename the project file
httpd.conf.default
tohttpd.conf
and make adjustments as necessary.-
In Nova code editor, the Build action in the Apache task will copy
httpd.conf
and make the necessary modifications automatically. -
In Nova code editor, the Clean action in the Apache task will remove error and log files that are created by the running Apache process.
-
-
Execute
apachectl start -f $(pwd)/httpd.conf
to start the Apache process.- In Nova code editor, the Run action in the Apache task will start the Apache process.
-
Execute
apachectl stop -f $(pwd)/httpd.conf
to stop the Apache process.- In Nova code editor, stopping the Run action in the Apache task will stop the running Apache process. It will also stop itself if it detects the process has been closed elsewhere.
To be able to use HTTPS with localhost we need a root certificate and a domain certificate specifically created for the localhost domain.
-
Follow the steps laid out by Daksh Shah to generate an SSL certificate for your local development environment.
-
Place the resulting
server.key
andserver.crt
files into the same directory ashttpd.conf
. -
Make adjustments to
httpd.conf
:-
Change
Listen localhost:8888 http
toListen localhost:8888 https
. -
Change
SSLEngine off
toSSLEngine on
.
-
mod_xsendfile is a module that allows you to instruct Apache to send a file. It is most useful when performing access checks in PHP, so you could allow or deny access to certain files depending on authentication or other metrics.
Download and follow the instructions to enable this module: https://github.com/nmaier/mod_xsendfile
I am also looking for a better way to install modules like this one directly through homebrew.