Membuat VirtualHost Nginx di Debian 8 Jessie

Pada kesempatan kali ini, penulis akan berbagi mengenai bagaimana cara membuat virtualhost menggunakan Nginx di Debian 8 Jessie.

Disini, penulis mencoba membuat dua virtualhost competition.indonesiahebat.net dan training.indonesiahebat.net

Baiklah, langsung saja.

Pertama, install dulu aplikasi nginx nya.

# apt install nginx -y

Setting file konfigurasi utama nginx :

# nano /etc/nginx/nginx.conf

Sebelum baris #mail { . Tambahkan baris seperti ini :

#VHOST1
server {
listen 80;
server_name competition.indonesiahebat.net
access_log /var/log/nginx/competition.log combined;
root /var/www/html/competition;
}

#VHOST2
server {
listen 80;
server_name training.indonesiahebat.net
access_log /var/log/nginx/training.log combined;
root /var/www/html/training;

}

Screenshot from 2017-10-04 10-27-06

Selanjutnya, buat directory root dan file index.html untuk kedua virtualhost.

# mkdir /var/www/html/competition

# mkdir /var/www/html/training

Untuk VirtualHost competition.indonesiahebat.net

# nano /var/www/html/index.html

Isi file dengan :

<html>
<h1>Welcome in the COMPETITION Indonesia Hebat</h1>
</html>

Sedangkan untuk virtualhost training.indonesiahebat.net :

# nano /var/www/html/training/index.html

Isi file dengan :

<html>
<h1>Welcome in the TRAINING Indonesia Hebat</h1>
</html>

 

Restart services nginx dengan cara :

# service nginx restart

Pengujian :

Screenshot from 2017-10-04 11-33-33.png

Screenshot from 2017-10-04 11-33-37

 

Sekian dari penulis.

Wassalamualaikum,

 

Advertisements

One thought on “Membuat VirtualHost Nginx di Debian 8 Jessie”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.