Steps to Point a Domain to Ubuntu Apache
![]() |
Apache PHP MySQL tools that power the web |
So creating website is hard for new people, i believe if you are just starting and never don't before, it is gonna be really frustrating experiences. Deployment process is also one hell of experiment, without the help of experienced people near you, you'll gonna end up scratching your head a lot.
These are steps to add a domain name like `example.com` to Ubuntu with Apache as the web server.
1. Login to your domain provider panel
I am using Namecheap, you can buy your domain anywhere.
- go to detail of your domain, then switch to Advanced DNS tab or something similar if you are not using Namecheap, maybe DNS management or could be something else.
- then set your host record, similar to this table:
Type
|
Host
|
Value
|
TTL
|
A Record
|
@
|
198.187.30.80
|
Automatic
|
A Record
|
www
|
198.187.30.80
|
Automatic
|
2. Set permission to your web root
Using Vim, Nano or any kind of text editor, and using root user, edit /etc/apache2/httpd.conf and add this lines to the end of the file:
<Directory /home/techgalery/public_html/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
/home/techgalery/public_html/ is where my website located, so change it to your own website path.
3. Create a site configuration for your domain
Inside /etc/apache2/sites-available create a new file your_domain_name.com.conf and add these lines:
<VirtualHost *:80> DirectoryIndex index.php index.html ServerName your_domain_name.com ServerAlias www.your_domain_name.com ServerAdmin webmaster@your_domain_name.com DocumentRoot /home/techgalery/public_html </VirtualHost>
Don't forget to change your_domain_name.com to actual domain name.
4. Then enable that configuration using this command
sudo en2site your_domain_name.com
5. To reload Apache
sudo service apache2 reload
I think by those steps, your domain should be pointed correctly to your web server. If there's any problem, it is better to contact your hosting provider, before you did too much and done nothing.
/etc/apache2/sites-avalable has a typo.
ReplyDeleteIt should be /etc/apache2/sites-available
Thanks
Delete