A powerful CLI tool to automatically configure Apache virtual hosts for Node.js applications on Bitnami installations.
- Interactive Setup: Guided configuration with user-friendly prompts
- Predefined Virtual Hosts: Automatically enable Bitnami's predefined configurations
- Custom Virtual Hosts: Create custom HTTP and HTTPS virtual host configurations
- Automatic Apache Restart: Seamlessly restart Apache after configuration
- Validation: Comprehensive validation of paths, permissions, and configurations
- HTTPS Support: Optional HTTPS virtual host configuration with SSL certificates
npx apache-node-proxy
npm install -g apache-node-proxy
apache-node-proxy
Run the tool and follow the interactive prompts:
sudo npx apache-node-proxy
The tool will ask for:
- Project Path: Path to your Node.js application
- Port: Port your application runs on (default: 3000)
- Application Name: Name for configuration files (default: myapp)
- Use Predefined: Whether to use Bitnami's predefined virtual hosts
- HTTPS: Whether to configure HTTPS virtual host
sudo npx apache-node-proxy quick --path /path/to/app --port 3000 --name myapp
- Bitnami Apache Installation: This tool is designed for Bitnami Apache installations
- Root Privileges: Must be run with
sudo
for Apache configuration - Node.js Application: Your application should be running on the specified port
- Linux Environment: Designed for Linux servers with Bitnami stack
If you choose to use predefined virtual hosts, the tool will:
- Copy
sample-vhost.conf.disabled
tosample-vhost.conf
- Copy
sample-https-vhost.conf.disabled
tosample-https-vhost.conf
- These files are pre-configured for port 3000
If you choose custom configuration, the tool will create:
HTTP Virtual Host (/opt/bitnami/apache/conf/vhosts/{appName}-http-vhost.conf
):
<VirtualHost _default_:80>
ServerAlias *
DocumentRoot "/path/to/your/app/public"
<Directory "/path/to/your/app/public">
Require all granted
</Directory>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
HTTPS Virtual Host (/opt/bitnami/apache/conf/vhosts/{appName}-https-vhost.conf
):
<VirtualHost _default_:443>
ServerAlias *
SSLEngine on
SSLCertificateFile "/opt/bitnami/apache/conf/bitnami/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apache/conf/bitnami/certs/server.key"
DocumentRoot "/path/to/your/app"
<Directory "/path/to/your/app">
Require all granted
</Directory>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
Automatically restarts Apache using:
sudo /opt/bitnami/ctlscript.sh restart apache
-
Start your Node.js application:
cd /path/to/your/app npm start
-
Run the proxy tool:
sudo npx apache-node-proxy
-
Follow the prompts:
- Enter project path:
/path/to/your/app
- Enter port:
3000
- Enter app name:
myapp
- Use predefined:
Yes
- Configure HTTPS:
Yes
- Enter project path:
-
Access your application:
- HTTP:
http://your-domain.com
- HTTPS:
https://your-domain.com
- HTTP:
-
Permission Denied
- Ensure you're running with
sudo
- Check file permissions on Apache directories
- Ensure you're running with
-
Bitnami Not Found
- Verify Bitnami is installed at
/opt/bitnami
- This tool is designed specifically for Bitnami installations
- Verify Bitnami is installed at
-
Apache Restart Failed
- Check Apache error logs:
/opt/bitnami/apache/logs/error_log
- Verify virtual host syntax
- Restart manually:
sudo /opt/bitnami/ctlscript.sh restart apache
- Check Apache error logs:
-
Application Not Accessible
- Ensure your Node.js application is running on the specified port
- Check firewall settings
- Verify domain DNS configuration
If the tool fails, you can manually configure virtual hosts:
-
Enable predefined virtual hosts:
sudo cp /opt/bitnami/apache/conf/vhosts/sample-vhost.conf.disabled /opt/bitnami/apache/conf/vhosts/sample-vhost.conf sudo cp /opt/bitnami/apache/conf/vhosts/sample-https-vhost.conf.disabled /opt/bitnami/apache/conf/vhosts/sample-https-vhost.conf
-
Restart Apache:
sudo /opt/bitnami/ctlscript.sh restart apache
The tool creates configuration files in:
/opt/bitnami/apache/conf/vhosts/
Generated files:
{appName}-http-vhost.conf
(HTTP virtual host){appName}-https-vhost.conf
(HTTPS virtual host)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details
If you encounter issues:
- Check the troubleshooting section
- Review Apache error logs
- Open an issue on GitHub with detailed information
Note: This tool is specifically designed for Bitnami Apache installations on Linux servers. For other Apache configurations, manual setup may be required.