Tips and tricks

Create a local dev Apache Mysql PHP Setup on Mac OS X - Add Virtual Hosts

How to create a local dev Apache Mysql PHP Setup on Mac OS X ‣ Digital Zoom Studio

also, remember to allow vhost_alias_module

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

You can add unlimited virtual hosts just like MAMP adds them. You can just access /private/etc/apache2/httpd.conf and add:

<VirtualHost *:80>
	ServerName devsite
	DocumentRoot "/Users/123/Dropbox/hosts/devsite"
    Protocols h2 h2c http/1.1

    <IfModule xsendfile_module>
        XSendFilePath "/Users/123/Dropbox/hosts/devsite"
    </IfModule>

	ServerAlias devsite.*

    <Directory "/Users/123/Dropbox/hosts/devsite">
        Options Indexes FollowSymLinks Includes ExecCGI
		AllowOverride All
        <IfModule authz_host_module>
            Require all granted
        </IfModule>
        Allow from all
		
    </Directory>

	<IfModule wsgi_module>
		WSGIDaemonProcess devsite processes=2 threads=15
		WSGIProcessGroup devsite
		WSGIScriptAlias /devsiteWsgiApp "/Users/123/Dropbox/hosts/devsite/wsgiapp.py"
	</IfModule>
	
</VirtualHost>

Add SSL Virtual hosts

first, you need to go to httpd.conf and enable ssl_module

Informal

remember to add your entry to /private/etc/hosts

127.0.0.1 devsite devsite.local

you can flush dns cache with sudo killall -HUP mDNSResponder

Frequently asked questions

Find apache folder
whereis httpd
Print apache config location
httpd -V
Create certificate for https hosts
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
  -keyout videogallery.key -out videogallery.crt \
  -subj "/CN=videogallery"
Create certificate with SAN
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
  -keyout dzsvideogallery.key -out dzsvideogallery.crt \
  -config ./san.cnf -extensions req_ext
san.cnf
[ req ]
default_bits       = 2048
prompt             = no
default_md         = sha256
req_extensions     = req_ext
distinguished_name = dn

[ dn ]
C  = RO
ST = SomeState
L  = SomeCity
O  = LocalDev
OU = Dev
CN = dzsvideogallery.me

[ req_ext ]
subjectAltName = @alt_names

[ alt_names ]
DNS.1 = dzsvideogallery.me
DNS.2 = www.dzsvideogallery.me
Restart apache with new config
apachectl restart
{"type":"main_options","images_arr":"'#ffffff'","enable_ajax":"off","soundcloud_apikey":"","bg_isparallax":"off","bg_slideshow_time":"0","bg_transition":"slidedown","site_url":"https:\/\/digitalzoomstudio.net","theme_url":"https:\/\/digitalzoomstudio.net\/wp-content\/themes\/qucreative\/","blur_ammount":"26","width_column":"50","width_section_bg":"","width_gap":"30","border_width":"0","border_color":"#ffffff","translate_cancel_comment":"Cancel reply","translate_leave_a_comment":"Leave a comment","translate_leave_a_comment_to":"Leave a comment to","is_customize_preview":"off","width_blur_margin":"30","gallery_w_thumbs_autoplay_videos":"off","content_enviroment_opacity":"30","menu_enviroment_opacity":"70","base_url":"https:\/\/digitalzoomstudio.net"}
{"type":"darkfull"}