Site icon Learning & Doing

Membuat virtual host Apache pada Rocky Linux

virtual

Pada kesempatan kali ini saya akan membahas cara Membuat virtual host Apache pada Rocky Linux.

Berikut langkah nya :

- config apache
nano /etc/httpd/conf.d/yourdomain.com.conf

<VirtualHost *:80>
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com
    DocumentRoot /var/www/yourdomain.com
    ErrorLog /var/www/yourdomain.com/error.log
    CustomLog /var/www/yourdomain.com/requests.log combined
</VirtualHost>

- buat direktori

mkdir /var/www/yourdomain.com
nano /var/www/yourdomain.com/index.html

<html>
  <head>
    <title>This is a test page</title>
  </head>
  <body>
    <h1>It works!</h1>
  </body>
</html>

- setup permission file

chown -R apache:apache /var/www/yourdomain.com/*
chmod -R 755 /var/www

- restart service
systemctl restart httpd

- setup local host
nano /etc/hosts
192.168.3.54 yourdomain.com

- akses your domain.com
Exit mobile version