Skip to content

Instantly share code, notes, and snippets.

@yus-ham
Last active November 16, 2018 17:11
Show Gist options
  • Save yus-ham/718828ee98e26acb8dab540979c8629f to your computer and use it in GitHub Desktop.
Save yus-ham/718828ee98e26acb8dab540979c8629f to your computer and use it in GitHub Desktop.

Konfigurasi domain/subdomain dengan wildcard di Apache2

Requirements:

  • Ubuntu 16.04
  • Apache2
  • DNSMASQ

misalnya:

Configuration

/etc/apache2/sites-enabled/catchall.conf

<VirtualHost *:80>
  ServerAlias localhost *.*.test #wildcard catch all
  VirtualDocumentRoot /home/suphm/sites/%2/web
  UseCanonicalName Off

  <Directory "/home/suphm/sites/">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerAlias localhost *.test #wildcard catch all
  VirtualDocumentRoot /home/suphm/sites/%1/web
  UseCanonicalName Off

  <Directory "/home/suphm/sites/">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

/etc/dnsmasq.d/domain.local

address=/local/127.0.0.1

/etc/dhcp/dhclient.conf

prepend domain-name-servers 127.0.0.1;
@yus-ham
Copy link
Author

yus-ham commented Aug 2, 2018

Ada masalah, di Ubuntu 18.04 gak bisa
dnsmasq[6886]: failed to create listening socket for port 53: Already in use

menurut disini harus men-set DNSStubHandler=no di /etc/systemd/resolved.conf
Masalah sudah teratasi tapi tidak bisa connect ke internet (googl, fb)

Info tambahan:

  • Koneksi internet dengan kabel USB ke HP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment