Membangun Website Linux Ubuntu bag. 2
2. Merubah Lokasi penyimpanan Website
Untuk merubah
tempat penyimpanan yang secara default pada direktory /var/www/ akan
dipindahkan misalnya ke direktory /home/tkjsmk/web/, tkjsmk/merupakan contoh folder user linux.
Membuat folder
web :
$ sudo mkdir /home/tkjsmk/web
Merubah
konfigurasi apache :
copy file
default ke file tkjsmk
$ sudo cp /etc/apache2/sites-available/default
/etc/apache2/sites-available/tkjsmk
Merubah isi
file tkjsmk
$ sudo gedit
/etc/apache2/sites-available/tkjsmk
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/tkjsmk/web/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/tkjsmk/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
ServerAdmin webmaster@localhost
DocumentRoot /home/tkjsmk/web/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/tkjsmk/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Ada 2 utiliy
yang digunakan yaitu:
a2ensite (apache2enabled
site)
untuk mengaktifkan site yang sudah kita buat pada langkah sebelumnya
a2dissite (apache2dissable site) untuk menon-aktifkan site sebelumnya
a2dissite (apache2dissable site) untuk menon-aktifkan site sebelumnya
Menon-aktipkan
default dan mengaktifkan tkjsmk :
$ sudo a2dissite default && sudo
a2ensite tkjsmk
Restart apche
$ sudo /etc/init.d/apache2 restart
Membuat file
index.html pada /home/tkjsmk/web/ :
$ sudo gedit /home/tkjsmk/web/index.html
Ketik contoh
html :
<HTML>
<TITLE>WEB TKJ</TITLE>
<BODY>
Selamat Datang
<BR>
<BR>
WEBSITE TKJ
<BR>
<BR>
Web ini disimpan dilokasi /home/tkjsmk/web/
</HTML>
<TITLE>WEB TKJ</TITLE>
<BODY>
Selamat Datang
<BR>
<BR>
WEBSITE TKJ
<BR>
<BR>
Web ini disimpan dilokasi /home/tkjsmk/web/
</HTML>
Mencoba
memanggil web tkj dengan aplikasi web browsing dengan alamat : http://localhost/
akan tampil
sebagai berikut :
Selamat Datang
WEBSITE TKJ
Web ini disimpan dilokasi /home/tkjsmk/web/
WEBSITE TKJ
Web ini disimpan dilokasi /home/tkjsmk/web/
Jika tidak
muncul seperti diatas, rubah atribut tkj :
$ sudo chmod 755 /home/tkjsmk/web/index.html
Ulangi lagi
memanggil web tkj.

0 komentar: