Tag Archives: SSH

Updating Nginx Server Configuration To Use The SSL You Have Purchased

You need to update the config file on your server to use the SSL certificate you are subscribed to. This can be done by accessing the command line SSH and opening the Nginx config file for the domain you are installing the SSL certificate.

Simply run the following command:

sudo vim /etc/nginx/sites-available/yourwebsite.com

Now update the config file to use the SSL certificate:

server {
        listen 80;
        server_name yourwebsite.com;
        return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;

    server_name yourwebsite.com;
    ssl_certificate     /etc/nginx/ssl/yourwebsite.crt;
    ssl_certificate_key /etc/nginx/ssl/yourwebsite.key;

    root /usr/share/nginx/yourwebsite.com/;
    index index.php  index.html index.htm;

}

The next step is to save the file using this command:

wq!

And then restart your Nginx server with this command:

sudo service nginx restart

That’s it.

Booting Your Linux VPS Or Dedicated Server In Rescue Mode

In the previous lesson, you learned about accessing and using the recovery console when you lose access to your Linux VPS or Dedicated Server.

Now, sometimes logging in through the recovery console doesn’t help or it doesn’t work for you then in that case you will need to boot your server in ‘Rescue Mode‘.

In rescue mode, you are given temporary login credentials that you use to get into your server via SSH to resolve your server-related issues.

Login to your SANGKRIT.net account and follow these steps:

  1. Visit your ‘Products‘ page
  2. On your ‘My Products‘ page, click ‘Manage
  3. Select ‘Rescue Mode‘ from ‘Server Actions‘ option
  4. Click ‘Confirm

A progress message will appear, and in a few minutes, your server will reboot to rescue mode. Your server dashboard will now show that your server is running in ‘Rescue Mode‘. This message appears next to your server name.

Now you can use those temporary login credentials to access your server via SSH and you will be able to access all files available on your server.

Complete your work and when you are done, click ‘Exit Rescue Mode‘ present in your server’s Dashboard. Your server will now reboot to the active mode i.e. normal mode.

Accessing The Recovery Console Of Linux VPS & Dedicated Server

In the previous lesson, you learned about the secure shell i.e. SSH. Next important thing is that if you lose access to your server due to some security issue, you can use the recovery console provided to you to regain access (via SSH) to your Linux VPS or Dedicated Server.

For example, in a case, if you have been accidentally locked out by some new firewall or IP rule then a recovery console is the thing you will need to regain access to your server. But there also you will need to know your server username and password so that you can connect to your server via SSH.

But before that, you should know while working on Linux VPS, some steps to regain access are different from the actual steps of the recovery console on the Dedicated Server.

So, If you are a VPS user simply follow these steps:

  1. Login to your SANGKRIT.net account and visit your Products page
  2. On your My Products page, click Servers, and next to the server you like to use, click Manage button
  3. Now in the top left corner of the Account Dashboard, select Recovery Console
  4. Next press Enter and now you can now log into your server to make changes

Whereas on a Dedicated Server, log in to your SANGKRIT.net account and follow these steps:

  1. Click the Servers option on your My Products page
  2. Click Manage right next to the Server you like to use
  3. On the top-right corner, click Server Actions
  4. Select Recovery Console

It takes a moment for the Recovery Console and then it automatically launches in a new browser tab. You will have to use your SSH login credentials to get into your server to make the required changes.

Now, the next important thing you should know is in case logging in through the Recovery Console does not work for you or it is of no help to you then, you should try booting your server in Rescue Mode. We will discuss the Server Rescue Mode in our next lesson.

Connecting Your Linux VPS or Dedicated Server With Secure Shell SSH

After you purchase a VPS or Dedicated Server, you will need to follow a few general steps to connect your server via SSH Secure Shell using a local client. This is needed to transfer, backup, or upload your web/app files etc.

What is Secure Shell SSH? ​​Secure Shell i.e. SSH is a cryptographic network protocol for operating network services securely. It is a method for doing a secure remote login from one device to another.

Here, the two devices are your local machine i.e. your computer, and your server i.e. your VPS or Dedicated Server.

Now the steps given here are the exact steps for making a connection via SSH but a few things may depend on the SSH client you use. If you don’t use Linux Terminal then you may use PuTTy for Windows, or Terminal on a macOS machine.

​​Before you start with the SSH login you will need to obtain this info:

  • Your domain name or IP address
  • Your primary FTP username
  • Your primary FTP password

In case you don’t know where to find these things, you may search their tutorials or simply email or call the online support team to get help.

For security reasons, your dedicated server is provisioned with disabled admin/root access. But you can enable it by following these steps:

  1. Login to your SANGKRIT.net account
  2. ​​Navigate to your My Products page
  3. Click Servers 
  4. Next to the Generation 4 server, click Manage
  5. Select Settings from the top of the page in your account dashboard
  6. In the access section, next to the admin access, click Manage
  7. Select Enable Admin Access (this is actually root account sudo access) 
  8. Now click Save
  9. Admin access is now enabled

Next, To establish a connection:

Launch your SSH client, enter the host i.e. your domain name or IP address, and your SSH port number (which by default is 22) to establish the SSH connection.

Now you will be asked to enter the FTP details, as prompted for that, enter your primary FTP username and password and click GO or whatever action button is there in your client.

That’s it. Your client will now make a connection.

Importing MySQL Databases Via SSH Command Line On Self Managed Servers

SANGKRIT.net not only offers you Managed and Fully Managed servers but it also lets you subscribe self-managed server option which is only recommended for command line experts. Because self-managed servers are without a control panel such as cPanel, Plesk, or Simple Control Panel.

These self-managed servers do not have phpMyAdmin installed which is used for managing MySQL databases. So in order to manage databases, you are required to use the SSH command line to import .SQL backup files.

This post guides you through importing MySQL databases via SSH.

Continue reading Importing MySQL Databases Via SSH Command Line On Self Managed Servers