Add the custom domains to Dnsmasq config. Default path /usr/local/etc/dnsmasq.conf
address=/.wp.local/127.0.0.1
address=/.lav.local/127.0.0.1
Start the service sudo brew services start dnsmasq
Create the local DNS resolver
sudo mkdir /etc/resolver
sudo touch /etc/resolver/local
Add to the newly created file
nameserver 127.0.0.1
Save and restat the Mac.
Default conf: /usr/local/etc/nginx/nginx.conf
- Symlink nginx document root to a more accessible place:
ln -s /usr/local/var/www /Users/rigo/Sites
- Add index.php to allowed indexes
- Add a server directive for dynamic subdomains on .wp.local
server {
listen 80;
server_name ~^(?<subfolder>.+)\.wp.local$;
root html/wp/$subfolder;
index index.php index.html index.htm;
error_log html/wp/error.log notice;
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
- Add a server directive for dynamic subdomains on .lav.local (serving /public)
server {
listen 80;
server_name ~^(?<subfolder>.+)\.lav.local$;
root html/lav/$subfolder/public;
index index.php index.html index.htm;
error_log html/lav/error.log notice;
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
- Start the service
brew services start nginx
Now you should have a common nginx + php-fpm configuration
- connect via cli
mysql -uroot
- create a new user for dev operations
CREATE USER 'dev'@'localhost' IDENTIFIED BY 'dev';
- grant needed privileges
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON *.* TO 'dev'@'localhost';
We are not creating users and roles as it becomes cumbersome to grant roles for each database to a non-superuser account. Just use the root account which should have as username your SO user and an empty password.
Edit the config at /usr/local/etc/php/7.2/php.ini
- memory_limit = 512M
- display_errors = On
- post_max_size = 128M
- upload_max_filesize = 128M
- sendmail_path = /usr/local/bin/mailhog sendmail test@test
Access the web interface at http://localhost:8025. Allow push notifications for better usage