Skip to content

Instantly share code, notes, and snippets.

@okitavera
Forked from anonymous/virtualhost.txt
Last active February 28, 2018 13:34
Show Gist options
  • Save okitavera/4233e4ace615a1377a691bf752335498 to your computer and use it in GitHub Desktop.
Save okitavera/4233e4ace615a1377a691bf752335498 to your computer and use it in GitHub Desktop.
masuk ke mode root:
# sudo su
masuk ke folder www
# cd /var/www
buat folder nya (contoh cobaweb) :
# mkdir /var/www/cobaweb.com
buat file index.html nya :
# gedit /var/www/cobaweb.com/index.html
chown foldernya :
# chown -hR namauser:namauser /var/www/cobaweb.com
masuk ke folder apache2/sites-available:
# cd /etc/apache2/sites-available/
copy file 000-default.conf ke nama webnya:
# cp 000-default.conf cobaweb.conf
edit file yang barusan dicopy:
# gedit cobaweb.conf
ganti <VirtualHost *:80> jadi <VirtualHost cobaweb.com:80>
hapus comment di bagian ServerName, dan edit www.example.com (misal jadi www.cobaweb.com)
lalu tambahkan dibawahnya:
ServerAlias www.cobaweb.com
edit DocumentRoot /var/www/html nya ke folder tadi (misal jadi /var/www/cobaweb.com)
save
lalu aktifasi sitenya:
# a2ensite cobaweb.conf
edit file hosts:
# gedit /etc/hosts
tambahkan di paling bawah:
127.0.0.1 cobaweb.com
127.0.0.1 www.cobaweb.com
lalu save.
restart service apachenya:
# sudo service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment