Confirmation of Correct Setup for New Droplet/Four Virtual Host Files

April 11, 2014 1.7k views
I’m moving four small, simple websites to a new droplet at Digital Ocean. I hope this post will help other new Digital Ocean users, also. I’ve setup plenty of websites over the years, but as these sites are live elsewhere — and I’ve never configured the “bones” and setup Apache from scratch, etc — I want to make sure that I didn’t miss a step somewhere before flipping the switch at the domain registrar. Thank you. 1) I setup an Ubuntu 12.04.3 x64 droplet using these instructions: 2) I used these initial server setup instructions to change the root password, create a user login that isn’t direct root, improve security, etc: 3) I installed Apache using these instructions: These sites are simple HTML/CSS, so MySQL and PHP aren’t even needed. Going directly to the assigned IP address in a web browser displays the default “It works!” HTML page. 4) I setup four virtual host files for each of the domain names using these instructions: As the sites are live on another host at the moment, I didn’t want to point the domain names to the VPS IP address yet, but sample home pages in each of the directories loaded correctly in a browser (i.e. IP Address/directory[site name]/public_html/ loads an HTML page). Are pages loading in each directory sufficient to determine that the virtual hosts are configured correctly? My assumption is no and this just confirms that the directories are setup correctly. 5) I setup hostnames using these instructions: I found this part of the instructions a little confusing. Specifically, I setup: A @ [IP Addresss] CNAME www @ NS [1-3] NS1.DIGITALOCEAN.COM, etc. I believe that is sufficient and correct. Is anything else needed in the hostname file? I would like to have non-www redirect to www, which I can do via .htaccess, if needed, but nothing atypical in terms of subdomains. I haven’t changed the DNS entries at the domain registrar to point to Digital Ocean’s domain servers yet. 6) I don’t use e-mail for any of these domain names, so mail server configuration is not needed (I didn’t setup any MX records). 7) I have logged into the IP address directly via FTP with the non-root default user and uploaded the files in the correct directories and copied over the .htaccess files via SSH, as well. Is that everything? Can I safely switch over the DNS entries at the domain name registry or have I missed something? Thank you, again. 8) After the switchover, I would like to setup the droplet so the IP address (and directories directly beneath the IP address) either don’t load or redirect to the default domain or applicable domain names. Perhaps this happens automatically. I couldn’t find documentation about this on Digital Ocean, but I think this might be helpful (although the ServerName already is set as specified by the virtual hosts tutorial): If anything needs to be done to disable/mask/redirect the exposed IP in a web browser and/or there are directly applicable instructions on Digital Ocean, please do let me know that as well. Thank you very much!
2 Answers
To double check the hostnames are setup, you could edit your /etc/hosts file (check google to find location on Windows) and force the new IP for the domains.

That way you can check the vhosts without having to change the DNS for everyone :)
Thank you. I did that already. I transferred one over and everything works except for the .htaccess file. I'll post a new question about that. Thanks, again.
Have another answer? Share your knowledge.