Press control + x to exit the nano editor.ħ. Press control + o and press enter to save the file.Ħ. Uncomment the LoadModule php7_module libexec/apache2/libphp7.so by removing the # in the front of that line of code.ĥ. Press control + w and type php (this will search for a line with keyword php in Apache’s config file.) Type sudo nano /etc/apache2/nf and press enter.Ĥ. MacOS has built-in PHP (at least in Big Sur and prior versions) You just need to enable the PHP from the Apache’s config file. Type sudo apachectl restart (this step will restart the Apache server to take effect of the changes made in the config file) Press control + x to exit the nano editor.Ħ. Press control + o and press enter to save the file.ĥ. Include /private/etc/apache2/users/*.confĤ. (this step is optional if you want to keep the copy of original file.)ģ. Type cd /etc/apache2/extra and press enter.Ģ. Press control + x to exit the nano editor. Press control + o and press enter to save the file.ġ2. # Controls who can get stuff from this server.ġ1. # AllowOverride FileInfo AuthConfig Limit # It can be "All", "None", or any combination of the keywords:
# AllowOverride controls what directives may be placed in. # The Options directive is both complicated and important. # Note that "MultiViews" must be named *explicitly* - "Options All" # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # Possible values for the Options directive are "None", "All", Your DocumentRoot configuration in nf will look like below: DocumentRoot "/Users/developer/Sites/" Replace AllowOverride None to AllowOverride All Press control + w and type AllowOverride None then enter developer) DocumentRoot "/Users/USERNAME/Sites/"ġ0. Note: USERNAME needs be replaced with your username (e.g. DocumentRoot "/Library/WebServer/Documents" (You can comment on those two lines by putting # in front of them. Replace the below two lines with your username document root. Uncomment the following line for the User home directories. LoadModule authn_core_module libexec/apache2/mod_authn_core.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule userdir_module libexec/apache2/mod_userdir.so LoadModule include_module libexec/apache2/mod_include.so LoadModule rewrite_module libexec/apache2/mod_rewrite.soħ. Use control + w to find each of the modules below. What we want to do is, uncomment this so the module is enabled.Ħ. That means that a specific line or module on that line will be ignored. The # you see in front of each line means that line is commented out. ( control + w will activate the search and it will look for a line with the keyword you put in) Press control + w and type LoadModule authz_core_module and press enter. Type sudo nano /etc/apache2/nf and press enter.ĥ. (This step is optional if you want to keep the copy of the original config file but I would recommend keeping one just in case.)Ĥ. Open the Terminal app from your Application folder or type Terminal in the Spotlight Search (shortcut: Command + Space Bar)ģ. Press Control + x to exit the nano editor. Press Control + o and press enter to save the file.Ĩ. Options Indexes MultiViews FollowSymLinksħ. Copy and paste the following configuration. Type sudo nano nf and press enter (note: username will be your account name e.g. If there is an existing nf, make a backup copy by typing sudo cp nf ĥ. Check if there is an existing nf file ( username is your account name)Ĥ. Type cd /etc/apache2/users and press enter.ģ. conf file with the name of nf under /etc/apache2/usersĢ. this is your account name / username) For example, if your username is developer, we will be making a. To be able to recognize the files putting into Sites directory, nf needed to be setup.ġ.
When the folder is created, it will generate a folder with a compass image on the folder as you can see from the below screenshot. It is recommended to create a Sites directory under username folder (username is your mac login name) This directory will be your document root for any web-related stuff. If Apache Server is started, you should see the below: Create Sites Directory Type localhost or 127.0.0.1 in the address bar Type sudo apachectl start and press enter To start the built-in Apache server, open the Terminal app from your Application folder or type Terminal in the Spotlight Search (shortcut: Command + Space Bar) MacOS comes with Apache Server by default.