How To Create Virtual Host On Ubuntu 14.04 Bagaimana Membuat Virtual Host Ubuntu

How To Create Virtual Host On Ubuntu 14.04 Bagaimana Membuat Virtual Host Ubuntu

Pertanyaan hari ini bagaimana membuat virtual host pada apache di ubuntu terbaru 14.04

Ada perbedaan pada ubuntu 14.04 yaitu pada file /etc/apache2/sites-available anda harus membuat file dengan extension .conf seperti contoh di bawah ini:

buat file pada /etc/apache2/sites-available dengan cara sebagai berikut:

cp 000-default.conf palembangcctv.conf

edit file palembangcctv.conf menjadi berikut:

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request’s Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName cctvpalembang.depobaja.com
ServerAlias palembangcctv.depobaja.com
ServerAdmin bundasunnatia@gmail.com
DocumentRoot /var/www/html/cvpangeran

# Available loglevels: trace8, …, trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with “a2disconf”.
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

simpan file kemudian jalankan perintah a2ensite palembangcctv.conf

root@suryayusra:/etc/apache2/sites-available# a2ensite palembangcctv.conf
Enabling site palembangcctv.
To activate the new configuration, you need to run:
service apache2 reload

reload service apache

root@suryayusra:/etc/apache2/sites-available# service apache2 reload
* Reloading web server apache2 *
root@suryayusra:/etc/apache2/sites-available# service apache2 restart
* Restarting web server apache2 AH00112: Warning: DocumentRoot [/var/www/html/cvpangeran] does not exist
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

Lakukan PING apakah server sudah merespon:

root@suryayusra:/etc/apache2/sites-available# ping palembangcctv.depobaja.com
PING palembangcctv.depobaja.com (118.97.174.155) 56(84) bytes of data.
64 bytes from 155.subnet118-97-174.static.astinet.telkom.net.id (118.97.174.155): icmp_seq=1 ttl=64 time=0.011 ms
64 bytes from 155.subnet118-97-174.static.astinet.telkom.net.id (118.97.174.155): icmp_seq=2 ttl=64 time=0.011 ms

Sebelumnya pada DNS rumahweb saya telah mengarahkan domain ke ip publik server

dns1