Nginx Virtual Host Creator (Magento 1, Magento 2, WordPress)
This Script creates Nginx virtual host for different applications. Supported Applications:
Magento 1- Magento 2
- WordPress
Others
INSTALL
To install, simply download the script file and give it the executable permission.
curl -O vhost-nginx.sh https://raw.githubusercontent.com/MagePsycho/nginx-virtual-host-bash-script/master/src/vhost-nginx.sh
chmod +x vhost-nginx.sh
To make it system wide command
sudo mv vhost-nginx.sh /usr/local/bin/vhost-nginx
OR
mv vhost-nginx.sh ~/bin/vhost-nginx
Make sure your $HOME/bin folder is in executable path
USAGE
To display help
sudo ./vhost-nginx.sh --help
To Create Virtual Host for Magento 2
sudo ./vhost-nginx.sh --domain=magento223ce.local --app=magento2 --root-dir=/var/www/magento2/magento223ce
To Create Virtual Host for WordPress
sudo ./vhost-nginx.sh --domain=wordpress494.local --app=wordpress --root-dir=/var/www/wordpress/wordpress494
Notes
- In case of system-wide command, you can omit the
--root-dirparameter if you run the command from the root directory of application.
Screenshots
Screentshot - Nginx Virtual Host Creator Help
Screentshot - Nginx Virtual Host Creator Result
RoadMap
- Support multiple applications (Magento 1,
WordPressetc.) - Option to configure virtual host template from separate file.
- Option to add SSL configuration