The user may open a secure shell on the server using the Secure Shell Protocol (SSH). The instruction uses the ssh command, available on Unix-like operating systems (e.g. Linux, MacOS). On a Windows operating system, ssh may be executed in the Git Bash application installed with Git for Windows.
ssh root@ip
replacing ip
with the IP address of the server, found in the Digital Ocean project.apt update
to identify package updates, using the apt package manager.apt dist-upgrade
to install package updates.adduser user
replacing user
with the user.usermod -aG sudo user
replacing user with the user.exit
to terminate the server shell.ssh-keygen
to generate the SSH keys./home/local-user/.ssh/hostname_user_id_rsa
replacing:local-user
with the name of the user of the local computer (displayed before @ in the shell)hostname
with the server hostname (e.g. domain-1)user
with the server user.ssh-copy-id -i /home/local-user/.ssh/hostname_user_id_rsa.pub user@ip
replacing: local-user
with the name of the user of the local computerhostname
with the server hostnameuser
with the server userip
with the IP address of the serverssh user@ip
replacing user
with the user and ip
with the IP address of the server, then enter the SSH key passphrase.cd /etc/nginx/conf.d
to enter the nginx configuration directory.sudo nano default.conf
to edit the default nginx server configuration file in the nano text editor; the first ten lines are below:
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
server {
listen 80;
server_name root_domain;
#access_log /var/log/nginx/host.access.log main;
location / {
#root /usr/share/nginx/html;
#index index.html index.htm;
default_type text/html;
return 200 "<!DOCTYPE html><p>root_domain is currently under construction; it will be available following Stripe integration.</p></html>";
}
}
ctrl+o
to save, Enter
to confirm save, and ctrl+x
to exit nano.sudo systemctl start nginx
to start nginx.sudo systemctl status nginx
to confirm ngnix is active.