Pertama, biasanya direktori path konfigurasi apache2 di ubuntu ada di
/etc/apache2/sites-available
Biasanya dalam direktori tersebut terdapat konfigurasi virtual host default isinya kurang lebih seperti berikut;
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
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> 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>
Untuk membuat virtual host baru siapkan dulu kebutuhan sebagai berikut:
1. Siapkan direktori untuk web kita misalkan di /var/www/replaycom.net
2. Buat direktori untuk menampung log misalnya di /var/www/replaycom.net/log
Selanjutnya, buat file konfigurasi virtualhost caranya :
sudo nano /etc/apache2/sites-available/replaycom.net
dalam teks editor tadi kita copy-paste saja kode berikut ke dalam file konfigurasi tersebut :
<VirtualHost *:80>
ServerAdmin admin@replaycom.net
Servername replaycom.net
ServerAlias www.replaycom.net
#Indeks + Direktori Root.
DirectoryIndex index.php index.html
DocumentRoot /var/www/replaycom.net# Logfiles # Logfiles
ErrorLog /var/www/replaycom.net/log/error.log
CustomLog /var/www/replaycom.net/log/access.log combined
</VirtualHost>Agar website berdomain replaycom.net tersebut konfigurasinya berjalan dan bisa diakses oleh apache lakukan perintah berikut:
sudo a2ensite replaycom.net
lalu
sudo /etc/init.d/apache2 reload
kemudian
sudo /etc/init.d/apache2 restart
konfigurasi virtual host sudah selesai, dan website replaycom.net bisa diakses :D
semoga bermanfaat :D

No comments:
Post a Comment