Configuring Virtual Host on my MAC

dhtmldhtml Posts: 1,002
edited August 2017 in Chats
So i wish to setup virtual host on my mac.



Step 1: find out where my configs are

$ apachectl -V

results:

-D APR_HAS_SENDFILE

-D APR_HAS_MMAP

-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)

-D APR_USE_FLOCK_SERIALIZE

-D APR_USE_PTHREAD_SERIALIZE

-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT

-D APR_HAS_OTHER_CHILD

-D AP_HAVE_RELIABLE_PIPED_LOGS

-D DYNAMIC_MODULE_LIMIT=256

-D HTTPD_ROOT="/usr"

-D SUEXEC_BIN="/usr/bin/suexec"

-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"

-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"

-D DEFAULT_ERRORLOG="logs/error_log"

-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"

-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"



Step 2: $ open /private/etc/apache2/httpd.conf

I examined and found the last line to contain Include /private/etc/apache2/other/*.conf



step 3: $ open /private/etc/apache2/other/

I can see a virtual-host.real.conf (i probably created this earlier)



Code:


ServerName localhost
DocumentRoot /www


Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted





ServerName africoders.dev
ServerAdmin [email protected]
DocumentRoot /public_html

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all







So edited the file with the config





$ sudo nano /etc/hosts

127.0.0.1 africoders.dev

127.0.0.1 www.africoders.dev



$ sudo apachectl restart

Comments

Sign In or Register to comment.