Difference between revisions of "Cloud Hosting/Hosts File"

From XMission Wiki
Jump to: navigation, search
(Mac OSX)
(Mac OSX)
 
(2 intermediate revisions by the same user not shown)
Line 53: Line 53:
  
 
==Mac OSX==
 
==Mac OSX==
You will need to open a terminal which can be done through your utilities folder.
+
 
 +
* You will need to open a terminal which can be done through your utilities folder.
  
 
[[File:OSXterminal.png|600px]]
 
[[File:OSXterminal.png|600px]]
  
 
* Edit your hosts file though a terminal
 
* Edit your hosts file though a terminal
*: type in <code> sudo vim /etc/hosts </code>
+
*:Type in <code> sudo vim /etc/hosts </code>
 +
 
 
[[File:Macosxsudovim.png]]
 
[[File:Macosxsudovim.png]]
  
 +
* You'll be prompted for a password, this should be your user password to login to your computer.
  
* From here you will want to add the IP address of your server and the hostname (eg. 166.70.181.4 example.com www.example.com)
+
* From here you will want to press " I " to enter insert mode, you will know you are in "insert mode" as -- INSERT -- should appear at the bottom left corner.
 +
 
 +
[[File:Insert_Mode.png]]
 +
 
 +
* Add the IP address of your server and the hostname (eg. 166.70.198.101 example.com www.example.com)
 
* Should look like this  
 
* Should look like this  
  
 
[[File:Macosxhosts.png]]
 
[[File:Macosxhosts.png]]
 
'''NOTE:''' if you are unable to add you will need to press " I " to enter insert mode
 
  
 
* Save and close your file  
 
* Save and close your file  
*: to save your file enter <code> :wq </code>
+
*: To save your file, first press "Esc" to exit "insert mode" then you can enter <code> :wq </code>
  
* run this in your terminal '''dscacheutil –flushcache'''
+
* Run this in your terminal <code> dscacheutil –flushcache </code>
  
 
[[File:Dnscacheclearmacosx.png]]
 
[[File:Dnscacheclearmacosx.png]]
  
*Now when you goto your domain on your computer it will resolve to the IP address you specified.
+
* Now when you goto your domain on your computer it will resolve to the IP address you specified.
 +
* You can test this by running a "Ping" in your terminal and see your host is resolving to the specified ip address.
  
<br><br>
 
  
 
--------------
 
--------------

Latest revision as of 08:46, 4 November 2019

Setting Up Hosts File

  • You can use these steps to view your site on your new Cloud server
  • NOTE: once you have completed the migration - make sure to remove this info from your host file

Video


Windows

  • Make sure you can view file extensions on your computer. Click on My Computer > Tools > Folder Options
    • Under Hidden Files and Folders - make sure it states Show hidden files and folder
    • Uncheck Hide extensions for known file types
    • Uncheck Hide protected operating system files (Recommended)
    • Click Apply

Navigate to C:\Windows\System32\drivers\etc\

Hostfiledocuexplorer.png

  • In this folder you should see a file called hosts
  • You can right click and choose Open or Open with - choose Notepad (NOTE: Windows 8 and higher users need to open Notepad as administrator.)

Note: on Windows 7 you can also use the "run" tool and open the hosts file by entering:

notepad c:\windows\system32\drivers\etc\hosts

Runhosts.png

Here is what it will look like.

Hostsnotepadeditted.png

  • Note that the pound character "#" causes the DNS software on your computer to consider anything that follows it in a line as a comment and will therefore ignore that part
  • You will want to add the following information we send you to the bottom of your hosts file:
<ip-address>  <domain.com>  <www.domain.com>
  • Where the <ip-address> is the ip address of your server (eg. 166.70.181.4) and <domain.com> is your domain name so it will look something like this:
166.70.22.1   mydomain.com  www.mydomain.com

Linux

  • Edit your hosts file though a terminal

Sudovimhosts.png

  • The line will look similar to this:

Vimhosts.png

  • From here you will want to add the IP address of your server and the hostname (example: 166.70.181.4 example.com www.example.com)
  • Save and close your file. Now when you go to your domain on your computer it will resolve to the IP address you specified.

Mac OSX

  • You will need to open a terminal which can be done through your utilities folder.

OSXterminal.png

  • Edit your hosts file though a terminal
    Type in sudo vim /etc/hosts

Macosxsudovim.png

  • You'll be prompted for a password, this should be your user password to login to your computer.
  • From here you will want to press " I " to enter insert mode, you will know you are in "insert mode" as -- INSERT -- should appear at the bottom left corner.

Insert Mode.png

  • Add the IP address of your server and the hostname (eg. 166.70.198.101 example.com www.example.com)
  • Should look like this

Macosxhosts.png

  • Save and close your file
    To save your file, first press "Esc" to exit "insert mode" then you can enter  :wq
  • Run this in your terminal dscacheutil –flushcache

Dnscacheclearmacosx.png

  • Now when you goto your domain on your computer it will resolve to the IP address you specified.
  • You can test this by running a "Ping" in your terminal and see your host is resolving to the specified ip address.



Cloud Hosting - Getting Started

To manage your Cloud Server, you will access the XMission Cloud Hosting Control Panel

For assistance in navigating your XMission Control Panel, please visit

Secure your Website

What is a SSL Certificate and How does it work?

Please vist to review a quick overview on why securing your website is a good idea.

Protect your Website

If you would like to learn how to control access to your server Click Here

  • XMission does recommend consulting a PHP or Apache Developer to ensure your .htaccess file is configured correctly. This could block total access to your Cloud Server.

FTP Access

FTP Access is typically recommend to connect to your Cloud Server. XMission requires SFTP Access to all hosting servers and suggests using FileZilla. To get help with acessing your server via FTP Click Here

SSH Access

From time to time you may need or want to use the command line to log in to your server. Your Cloud Server is accessible via a Secure Shell Interface also referred to as SSH. For help accessing your server via SSH please Click Here

Server Logs

You may need to look at your server logs. These can be access via SSH or FTP. To locate those logs Click Here

Scheduled Tasks

Cron enables users to schedule jobs (commands or shell scripts) to run automatically at a certain time or date. Some best practices to setting up Cron's:

Migrating MySql

If you are moving an excising website to your XMission Cloud Server, a MySql Database is most likely needed. If you'd need some help importing that database please Click Here

Cloud PHP Info

XMission's Default PHP Info for your Cloud Server: PHP Info

Host Files

How to set up Host Files

SSH Keys

SSH keys allow users to SSH to servers with a more secure method rather than having to rely on passwords alone. To set up SSH Keys Click Here

Server Security

For customers that sign up for Unmanaged Cloud Servers, XMission strongly recommends a few easy steps to take to ensure that your unmanaged Cloud Server stays up-to-date and secure at all times.