Hi guys (like a youtuber 😀 ),
If you have an experience about hosting, you know hosting panels like Plesk, cPanel. We often use these panels but this method can leave us ignorant. Upss, why?
When we use panels, we use just buttons for running, editing, removing etc. so we do not know the commands running behind. I am always wondering about the commands that running behind, if you’re wondering like me, join me 🙂
Result of wondering, I have a lot of virtual machines on my machine and a droplet on DigitalOcean, for test. In this scenario, we want to host multi site on a server (DigitalOcean Droplet). You will see, it’s too simple. At the end, you know how panels works for this event.
Ok, let’s start.
1. Set the DNS Zones,
DigitalOcean home page -> Networking -> Domains -> Add a Domain
Add domains that you want to host on the droplet.
More -> Manage Domain
You must do this step(Manage Domian) for every domain.
2. Create web directory for every domain ,
You can use “/var/www” directory or any directory.
For example, you can create a directory in /home/ directory for every domain (domainname.ext). Like below,
3. Configure Apache,
Now, we must tell our purpose to Apache.
Me: Hey Apache, I have a few domain and I want to host these sites on this server.
Apache: Ok bro, you can tell your domains to me.
cd /etc/apache2/sites-available/ touch domainame.ext.conf ls
Edit every conf files like below,
# Other directives here, e.g. :
Options Indexes FollowSymLinks MultiViews
Allow from all
CustomLog /var/log/apache2/domainname.ext-access_log common
And run the commands for every conf files,
ln -s /etc/apache2/sitesi-available/domainname.ext.conf /etc/apache2/sitesi-enabled/domainname.ext.conf a2ensite domainname.ext.conf
Final step, restart Apache service,
sudo service apache2 restart
They are in the same server.