httpd -v
sudo atom /etc/apache2/httpd.conf
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php7_module libexec/apache2/libphp7.so
SSL:
LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
LoadModule ssl_module libexec/apache2/mod_ssl.so
Include /private/etc/apache2/extra/httpd-ssl.conf
User tommyskott
Group staff
DocumentRoot "/Users/tommyskott/wwwroot"
<Directory "/Users/tommyskott/wwwroot">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
Include /private/etc/apache2/extra/httpd-vhosts.conf
Include /private/etc/apache2/vhosts/*.conf
cd /etc/apache2/extra/httpd-ssl.conf
Comment out everything in:
<VirtualHost _default_:443></VirtualHost>
brew install mkcert
brew install nss # if you use Firefox
mkcert -install
mkdir /tmp/crt && cd /tmp/crt
mkcert borgenfalk.local "*.borgenfalk.local"
sudo mkdir /etc/apache2/ssl
sudo mv *.pem /etc/apache2/ssl
sudo mkdir /etc/apache2/vhosts
cd /etc/apache2/vhosts
sudo touch _default.conf
sudo atom _default.conf
<VirtualHost *:80>
DocumentRoot "/Users/tommyskott/wwwroot"
</VirtualHost>
sudo touch 001-borgenfalk.local.conf
sudo atom 001-borgenfalk.local.conf
<VirtualHost *:80>
ServerName borgenfalk.local
ServerAlias www.borgenfalk.local
DocumentRoot /Users/tommyskott/wwwroot/borgenfalk
ErrorLog "/private/var/log/apache2/borgenfalk.local-error_log"
CustomLog "/private/var/log/apache2/borgenfalk.local-access_log" common
<Directory "/Users/tommyskott/wwwroot/borgenfalk">
Options FollowSymLinks Indexes
AllowOverride All
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =borgenfalk.local [OR]
RewriteCond %{SERVER_NAME} =www.borgenfalk.local
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
sudo cp 001-borgenfalk.local.conf 001-borgenfalk.local-ssl.conf
sudo atom 001-borgenfalk.local-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName borgenfalk.local
ServerAlias www.borgenfalk.local
DocumentRoot /Users/tommyskott/wwwroot/borgenfalk
ErrorLog "/private/var/log/apache2/borgenfalk.local-error_log"
CustomLog "/private/var/log/apache2/borgenfalk.local-access_log" common
SSLEngine on
SSLCertificateFile "/private/etc/apache2/ssl/borgenfalk.local+1.pem"
SSLCertificateKeyFile "/private/etc/apache2/ssl/borgenfalk.local+1-key.pem"
</VirtualHost>
</IfModule>
apachectl restart
apachectl configtest
sudo atom /etc/hosts
127.0.0.1 borgenfalk.local
127.0.0.1 www.borgenfalk.local
dscacheutil -flushcache
Note: some missing modules in built-in php on macOS Mojave. Let's install it from brew instead.
brew install php
brew services start php
php -v
php --ini
php -i
php -m
Since brew
is not used as default package manager for PHP on Mac anymore, you have to use pecl to install additional PHP extensions.
brew install imagemagick
pecl install imagick
brew install php@7.1
brew unlink php && brew link --force php@7.1
echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.zshrc
brew services stop php
brew services start php@7.1
Note: Problems with using root user in mariadb. Login with sudo and create a new user and give them all privileges.
brew install mariadb
brew services start mariadb
mysql -V
which mysql
sudo mysql -u root -p
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
exit
brew services restart mariadb
brew tap homebrew/cask-versions
brew cask install sequel-pro-nightly