Last active
September 17, 2015 08:47
-
-
Save sb-lc/1fe46bfb961804029200 to your computer and use it in GitHub Desktop.
bash script - vhost create
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
creates project folder /var/www/project/ and corresponding .conf file in /etc/apache2/sites available, a2ensite to enable, create index.html | |
add text : | |
127.0.1.1 lc-dev1.local | |
to end of the file /etc/hosts | |
Create a new vHost in Ubuntu Server | |
Assumes /etc/apache2/sites-available and /etc/apache2/sites-enabled setup used | |
-d DocumentRoot - i.e. /var/www/yoursite | |
-h Help - Show this menu. | |
-s ServerName - i.e. example.com or sub.example.com | |
-a ServerAlias - i.e. *.example.com or another domain altogether | |
-p File path to the SSL certificate. Directories only, no file name. | |
If using an SSL Certificate, also creates a port :443 vhost as well. | |
This *ASSUMES* a .crt and a .key file exists | |
at file path /provided-file-path/your-server-or-cert-name.[crt|key]. | |
Otherwise you can except Apache errors when you reload Apache. | |
Ensure Apaches mod_ssl is enabled via "sudo a2enmod ssl". | |
-c Certificate filename. "xip.io" becomes "xip.io.key" and "xip.io.crt". | |
Example Usage. Serve files from /var/www/xip.io at http(s)://192.168.33.10.xip.io | |
using ssl files from /etc/ssl/xip.io/xip.io.[key|crt] | |
sudo vhost -d /var/www/xip.io -s 192.168.33.10.xip.io -p /etc/ssl/xip.io -c xip.io |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment