Thursday, April 15, 2021

How do configure apache web server on MAMP on a Mac?

To install MAMP Read here.

 Open Terminal in Mac

If sudo su (doesn't work)

Use : "sudo -s"

This should bring you to a bash prompt


httpd -v

Server version: Apache/2.4.34 (Unix)
Server built:   Feb 22 2019 20:20:11


apachectl stop
apachectl start

If it's already started, you may see a message similar as follows:
apachectl start
/System/Library/LaunchDaemons/org.apache.httpd.plist: service already loaded
apachectl status

Open "http://localhost:80" in the web browser of your choice.

Stopping a server

apachectl graceful

apachectl -k stop
AH00557: httpd: apr_sockaddr_info_get() failed for amoni-mac
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

To Unload the server

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


In order to avoid the message above,you can configure the server name using the command in the Terminal

vi /etc/apache2/httpd.conf

Look for the following section and uncomment #ServerName <provide a name here>

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost

No comments:

Post a Comment

Please add value. Sharing is caring