Bu Bash Script sizga apache/nginx yangi local domen(virtual hosts) yaratish va o'chirish amallarini bir qator buyruq bilan bajarishga yordam beradi. Ubuntu uchun.
- Scriptni yuklab oling.
- Kerakli buyruqlarni bajarishi uchun unga huquq bering:
$ chmod +x /path/to/vhost.sh
- Tanlovli: Agar siz scriptni global muhitda ishlatmoqchi bo'lsangiz, unda bu faylni /usr/local/bin papkaga ko'chiring, is better Agar .sh formatsiz nusxalasangiz qulay bo'ladi:
$ sudo cp /path/to/vhost.sh /usr/local/bin/vhost
Asosiy buyruq sintaksis:
$ sudo sh /path/to/vhost.sh [create | delete] [domain] [optional host_dir]
/usr/local/bin ga o'rnatilganda
$ sudo vhost [create | delete] [domain] [optional host_dir]
Yangi virtual host yaratish uchun:
$ sudo vhost create mysite.dev
Yangi virtual hostni o'zingiz xohlagan papka yo'naltirmoqchi bo'lsangiz:
$ sudo vhost create anothersite.dev my_dir
Virtual host ni o'chirish uchun
$ sudo vhost delete mysite.dev
Maxsus papkaga o'rnatilgan virtual host o'chirmoqchi bo'lsangiz:
$ sudo vhost delete anothersite.dev my_dir
#Happy coding!