Complete system to manage local domains, SSL certificates, and Apache configuration on macOS natively (without MAMP Pro).
- macOS (Ventura or later)
- Homebrew installed
- PHP 8.4 (installed)
- MySQL 8.4 (installed)
- Apache 2.4 (native macOS)
# Add PHP 8.4 and MySQL to PATH
echo 'export PATH="/opt/homebrew/opt/php@8.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@8.4/sbin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/mysql@8.4/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc# Start PHP-FPM
brew services start php@8.4
# Start MySQL
brew services start mysql@8.4
# Configure MySQL (optional - set root password)
mysql_secure_installation# Grant execution permissions to scripts
chmod +x ~/localhost-manager/scripts/*.sh
# Generate all SSL certificates
bash ~/localhost-manager/scripts/generate-certificates.sh- Open your browser
- Go to:
http://localhost/manager - Use the interface to:
- Generate SSL certificates
- Create Apache configuration
- Generate /etc/hosts file
- Manage domains and aliases
The interface shows:
- System Information: PHP, Apache, and MySQL versions
- Quick Actions: Buttons to generate certificates, configuration, etc.
- Domain List: Table with all configured domains
- Click "Generate All Certificates"
- Or generate individual certificates with the "Cert" button on each row
- Click "Generate Apache Configuration"
- This creates the file
~/localhost-manager/conf/vhosts.conf
- Click "Generate /etc/hosts"
- Run the command that appears:
sudo bash ~/localhost-manager/scripts/update-hosts.shAfter generating the configuration, run:
sudo bash ~/localhost-manager/scripts/install.shThis script:
- Configures PHP 8.4 in Apache
- Enables necessary modules (SSL, rewrite, etc.)
- Copies certificates to
/etc/apache2/ssl - Applies virtual hosts configuration
- Restarts Apache
- In the web interface, go to "Add New Domain" section
- Fill in the fields:
- Domain:
mydomain.local - Alias (optional):
www.mydomain.local - Document Root:
/Users/youruser/Sites/localhost/mydomain.local
- Domain:
- Click "Add Domain"
- Generate SSL certificate for the domain
- Regenerate Apache configuration
- Update /etc/hosts
- Run the installation script
~/localhost-manager/
├── certs/ # Generated SSL certificates
├── conf/ # Configuration files
│ ├── hosts.json # Domain database
│ ├── hosts.txt # Entries for /etc/hosts
│ └── vhosts.conf # Apache configuration
├── scripts/ # Management scripts
│ ├── generate-certificates.sh
│ ├── generate-vhosts-config.sh
│ ├── install.sh
│ └── update-hosts.sh
└── README.md
/Users/youruser/Sites/localhost/
└── manager/ # Web interface
└── index.php
To make services start automatically on system boot:
# PHP-FPM
brew services start php@8.4
# MySQL
brew services start mysql@8.4
# Apache (macOS)
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plistTo stop services:
brew services stop php@8.4
brew services stop mysql@8.4
sudo apachectl stop# Start Apache
sudo apachectl start
# Stop Apache
sudo apachectl stop
# Restart Apache
sudo apachectl restart
# Verify configuration
sudo apachectl configtest
# View loaded modules
sudo apachectl -M# View version
php --version
# View configuration
php --ini
# Edit php.ini
nano /opt/homebrew/etc/php/8.4/php.ini# Connect to MySQL
mysql -u root -p
# View databases
mysql -u root -p -e "SHOW DATABASES;"
# Service status
brew services list | grep mysqlSelf-signed certificates are valid for 10 years (3650 days).
To trust a certificate on macOS:
- Open Keychain Access
- Drag the
.crtfile from~/localhost-manager/certs/ - Double-click the certificate
- Expand "Trust"
- Select "Always Trust"
# View error log
tail -f /var/log/apache2/error_log
# Verify configuration
sudo apachectl configtest# Verify module is loaded
sudo apachectl -M | grep php
# Verify php.ini
php --iniAdd the certificate to Keychain Access (see SSL Certificates section).
# See what process is using the port
sudo lsof -i :80
sudo lsof -i :443
# Stop MAMP if running- Free and open source
- Native macOS configuration
- Better performance
- Easy component updates
- Full configuration control
- Modern web administration interface
- Automatic SSL certificate generation
- Domain alias support
For issues or suggestions, check the logs:
- Apache:
/var/log/apache2/error_log - PHP:
/opt/homebrew/var/log/php-fpm.log - MySQL:
/opt/homebrew/var/mysql/*.err
Author: Localhost Manager Version: 1.0.0 Date: November 2025