@@ -8,56 +8,74 @@ Bash Script to allow create or delete apache/nginx virtual hosts on Ubuntu on a
881 . Download the script
992 . Apply permission to execute:
1010
11- $ chmod +x /path/to/virtualhost.sh
11+ ```
12+ $ chmod +x /path/to/virtualhost.sh
13+ ```
1214
13153 . Optional: if you want to use the script globally, then you need to copy the file to your /usr/local/bin directory, is better
1416if you copy it without the .sh extension:
1517
16- $ sudo cp /path/to/virtualhost.sh /usr/local/bin/virtualhost
18+ ``` bash
19+ $ sudo cp /path/to/virtualhost.sh /usr/local/bin/virtualhost
20+ ```
1721
1822### For Global Shortcut ###
1923
20- $ cd /usr/local/bin
21- $ wget -O virtualhost https://raw.githubusercontent.com/RoverWire/virtualhost/master/virtualhost.sh
22- $ chmod +x virtualhost
23- $ wget -O virtualhost-nginx https://raw.githubusercontent.com/RoverWire/virtualhost/master/virtualhost-nginx.sh
24- $ chmod +x virtualhost-nginx
24+ ``` bash
25+ $ cd /usr/local/bin
26+ $ wget -O virtualhost https://raw.githubusercontent.com/RoverWire/virtualhost/master/virtualhost.sh
27+ $ chmod +x virtualhost
28+ $ wget -O virtualhost-nginx https://raw.githubusercontent.com/RoverWire/virtualhost/master/virtualhost-nginx.sh
29+ $ chmod +x virtualhost-nginx
30+ ```
2531
2632## Usage ##
2733
2834Basic command line syntax:
2935
30- $ sudo sh /path/to/virtualhost.sh [create | delete] [domain] [optional host_dir]
36+ ``` bash
37+ $ sudo sh /path/to/virtualhost.sh [create | delete] [domain] [optional host_dir]
38+ ```
3139
3240With script installed on /usr/local/bin
3341
34- $ sudo virtualhost [create | delete] [domain] [optional host_dir]
35-
42+ ``` bash
43+ $ sudo virtualhost [create | delete] [domain] [optional host_dir]
44+ ```
3645
3746### Examples ###
3847
3948to create a new virtual host:
4049
41- $ sudo virtualhost create mysite.dev
42-
50+ ``` bash
51+ $ sudo virtualhost create mysite.dev
52+ ```
4353to create a new virtual host with custom directory name:
4454
45- $ sudo virtualhost create anothersite.dev my_dir
46-
55+ ``` bash
56+ $ sudo virtualhost create anothersite.dev my_dir
57+ ```
4758to delete a virtual host
4859
49- $ sudo virtualhost delete mysite.dev
60+ ``` bash
61+ $ sudo virtualhost delete mysite.dev
62+ ```
5063
5164to delete a virtual host with custom directory name:
5265
53- $ sudo virtualhost delete anothersite.dev my_dir
54-
66+ ```
67+ $ sudo virtualhost delete anothersite.dev my_dir
68+ ```
5569### Localization
5670
5771For Apache:
5872
59- $ sudo cp /path/to/locale/<language>/virtualhost.mo /usr/share/locale/<language>/LC_MESSAGES/
73+ ``` bash
74+ $ sudo cp /path/to/locale/< language> /virtualhost.mo /usr/share/locale/< language> /LC_MESSAGES/
75+ ```
6076
6177For NGINX:
6278
63- $ sudo cp /path/to/locale/<language>/virtualhost-nginx.mo /usr/share/locale/<language>/LC_MESSAGES/
79+ ``` bash
80+ $ sudo cp /path/to/locale/< language> /virtualhost-nginx.mo /usr/share/locale/< language> /LC_MESSAGES/
81+ ```
0 commit comments