I am creating virtual host -- For that I have followed below Url details
set-up-apache-virtual-hosts-on-ubuntu
I have created virtual host of name raveesmake.com also restarted apache server.
When I do ping command for raveesmake.com It displays packet data sent and received.
Now I want to make this site as live, So that anyone can access it by following raveesmake.com. But until and unless I add this in my local machin host file the site is not loading.
Did I need to add entry in DNS manager of linode? Before adding host did it check whether host has already buyed / available?
22 Answers
You will need to add DNS entry to:
@.host.com IP sub.host.com IP
Visiting browser will resolve your IP from hostname via DNS, and then send request via HTTP connection to your apache. Apache will check HOST header, like myhost.com or sub.host.com and will use associated virtual host loaded.
But it is completely irrelevant how you name your virtual host file. You only set ServerName and number of ServerAlias directives in it:
<VirtualHost *:80> ServerName host.com ServerAlias sub.host.com ServerAlias mirror.host.comIf apache receives an unknown HOST header (no ServerName associated from it among loaded virtual hosts), it will just use the first virtual host loaded, so if you have only one site, you can remove ServerName and ServerAlias, but disable "default" apache hosts (with hello-world pages):
sudo a2dissite 000-default default-sslFor questions regarding apache2, use ServerFault stackexchange.
First create a .conf file located at /etc/apache2/sites-available/MyDomain.com.conf.
NOTE: REPLACE MyDomain.com with your domain name as wanted
Then type command nano /etc/apache2/sites-available/MyDomain.com.conf to edit the file and paste this codes to it:
# domain: MyDomain.com
# public: /var/www/html/
<VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin ServerName MyDomain.com ServerAlias # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /var/www/html/ # Log file locations LogLevel warn ErrorLog /var/www/html/ CustomLog /var/www/html/ combined
</VirtualHost>This is the default .conf file provided by Linode
Then type the command a2dissite *default to remove or disable the default apache2 and then type a2ensite MyDomain.com.conf to enable the site. Also, type service apache2 reload to make the site live.
AGAIN, TAKE NOTE TO REPLACE MyDomain.com with your domain
You might want to add the DNS zones to linode and add a slave IP.
Step 1:
Login to Linode and Click DNS Manager and click add a domain zone. Then Provide these details:
Step 2:
Go to Linodes>YourLinode###>Remote Access and click reverse DNS. In then put your domain there and click Look up