- 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/nullto prevent the default Apache process from starting with the system. -
Execute
brew install php@7.4.- Other versions of php can be installed and unlinked/linked as needed. For example:
brew unlink php@7.4thenbrew link php@7.3to 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.defaulttohttpd.confand make adjustments as necessary.-
In Nova code editor, the Build action in the Apache task will copy
httpd.confand 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.confto 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.confto 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.keyandserver.crtfiles into the same directory ashttpd.conf. -
Make adjustments to
httpd.conf:-
Change
Listen localhost:8888 httptoListen localhost:8888 https. -
Change
SSLEngine offtoSSLEngine 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.