0% found this document useful (0 votes)
108 views4 pages

HTML Page On Vultr VPS PDF

This document provides instructions for setting up two websites on an Ubuntu server using Nginx. It involves installing Nginx, configuring sites files for each domain, creating directories for the website files, testing the configuration, and installing HTTPS certificates for both domains using Certbot.

Uploaded by

sekhar203512
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views4 pages

HTML Page On Vultr VPS PDF

This document provides instructions for setting up two websites on an Ubuntu server using Nginx. It involves installing Nginx, configuring sites files for each domain, creating directories for the website files, testing the configuration, and installing HTTPS certificates for both domains using Certbot.

Uploaded by

sekhar203512
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Html Page on Vultr VPS

1. Create a Droplet, copy the ip and use this command to login terminal

• Ssh root@youripaddress
• Password and enter

2. We should install nginx on that server or any other server but agin is highly preferred

• To install nginx on linux ubuntu server, we use the command “sudo apt-get install nginx” nginx
required some dependencies to work sometime they are preinstalled on the server and other
times we have to install them by overselves by the following commands.
“sudo apt-get install build-essential”

• To update this library and to make sure that all the programs are up to date we write
“sudo apt update && sudo apt upgrade”

3. It included a list of official apps that are available to download for linux. when we write these
commands it makes sure we have the latest one

• Commands in order should be:


• sudo apt update && sudo apt upgrade (START FROM HERE DIRECTLY)
• sudo apt-get install build-essential
• sudo apt-get install nginx

4. After doing all these steps test it opening on browser using the ip address you will see a welcome
message from nginx, if shows then everything is fine till now.

5. Now we need to configure the server to listen to connections for those domains and instruct where
to find the website files

• To configure the nginx settings, they are installed in “cd /etc/nginx/sites-enabled”


• We have to create two new configuration files with domain name and the settings below the
files should be ending with first domain.conf and second domain.conf and paste the code
below in each file.
• An example of a default configuration code file would be like this

server {
listen 80;
listen [::]:80;
server_name yourfirstdomain.com www.yourfirstdomain.com;
# The line below is used to tell the server where the website files are
root /var/www/yourfirstdomain.com/public_html;
# In this case it is expecting a folder named with your domain in “/var/www”
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
• Before this point the domain to the server going to vultr server products dns settings add the
domain, ip and save it, once you point the domain to the server you will see Welcome to
nginx message when you access the domain.
• To add the above mentioned code follow the commands given below.
• cd /etc/nginx/sites-enabled/
• you will see this reply command /etc/nginx/sites-enabled#
• type only ls at the end of the reply command and enter like this
• root@New_Server2:/etc/nginx/sites-enabled# ls (here l means small L) enter it you will see a
“default” command below that as a result, now move further
• next add “ls -al” at the end of the result command like this and enter.
• root@New_Server2:/etc/nginx/sites-enabled# ls -al (here l means small L)

6. Now you should copy and paste the configuration code in a new file and move it to the settings
folder. (the code is mentioned above, you can copy the and paste)

7. To get out of text editor on terminal press Esc and then : (the colon). The cursor will go to the
bottom of the screen at a colon prompt. Write your file by entering :wq! And enter

8. No do the following
• root@New_Server2:~# cd /etc/nginx/sites-enabled (enter)
• root@New_Server2:/etc/nginx/sites-enabled# ls (LS small)
default
• root@New_Server2:/etc/nginx/sites-enabled# ls -al
default in last line
• root@New_Server2:/etc/nginx/sites-enabled#

9. Now you should copy and paste the configuration code in a new file and move it to settings folder.
10. You can do it by the terminal directly with ”vi” command or create a new file then upload it.

• root@New_Server2:/etc/nginx/sites-enabled# vi pickmoneyonline.com (enter)

11. This will opens the text editor in the terminal, I’m going to press “i” in the terminal to open the text
editor to change the mode to edit then past the code below and adjust the settings. Change all the
domain names to your real domain names in 3 places, after you done it press ESC button once
then semi colon : then wq and ! in total :wq! (enter) it will save and exit from text editor.

Next
• root@New_Server2:/etc/nginx/sites-enabled# vi pickmoneyonline.com.conf (enter)
• root@New_Server2:/etc/nginx/sites-enabled#

12. Now I copy this file to the second domain from first one

• root@New_Server2:/etc/nginx/sites-enabled# cp pickmoneyonline.com.conf
picmoneyonline.club (enter)
• root@New_Server2:/etc/nginx/sites-enabled# c (enter)
• root@New_Server2:/etc/nginx/sites-enabled# ls (LS small)
default picmoneyonline.club pickmoneyonline.com.conf (here you see only one .conf domain)
• root@New_Server2:/etc/nginx/sites-enabled#

13. We make sure that both the domains are with .conf extension otherwise we need to add this
14. To rename or change the domain or anything like that we need to use “mv” command

• root@New_Server2:/etc/nginx/sites-enabled# mv picmoneyonline.club
picmoneyonline.club.conf (there should be one space between 2 domains and enter)
• root@New_Server2:/etc/nginx/sites-enabled# ls (LS small) (enter)
• default picmoneyonline.com.conf pickmoneyonline.com.conf
Now you can see both the domains with .conf extension, now its ok.
• root@New_Server2:/etc/nginx/sites-enabled#

15. So we should make this configuration & name it once under domain one then copy it & name it
under domain two with the settings to be changed inside where it says
YOURFIRSTDOMAIN.COM

16. Next we create a directory (folder) for each website in /var/www/ by the following
to go to the directory use “cd /var/www/”

• root@New_Server2:/etc/nginx/sites-enabled# cd /var/www (enter)


• root@New_Server2:/etc/nginx/sites-enabled# ls (LS small and enter)
html
• root@New_Server2:/var/www# mkdir pickmoneyonline.com
• root@New_Server2:/var/www# cd pickmoneyonline.com
• root@New_Server2:/var/www/pickmoneyonline.com# public_html
• root@New_Server2:/var/www/pickmoneyonline.com#

17. Now go to the /var/www/pickmoneyonline.com/public_html, create one index.html file in it and


write some text on it, after that restart the nginx using the below command.
“sudo service nginx restart”
Now you go to browser and access the site you will find the text on it.

18. Now copy the same directory to the 2nd domain.

• root@New_Server2:/var/www# mkdir pickmoneyonline.com# cd .. (this command wll goes a


step back)
• root@New_Server2:/var/www#
• Here you add the below code to copy the first domain directory to second domain.
• cp -r yourfirstdomain.com yourseconddomain.com
• Now see whether they copied or not using this command ls
• root@New_Server2:/var/www# ls (LS small enter)
• html yourfirstdomain.com yourseconddomain.com
you can see both the domains that means the directory has been copied.

19. After creating 2 configuration files in /etc/nginx/sites-enabled/ and adjusting their settings, after
creating the folder where the website files will stay stored. We should test the configuration files
that they have no errors by running this command.

• sudo nginx -t
• root@New_Server2:# sudo nginx -t (enter) it will show everything ok and successful
now we restart the nginx using this code “sudo service nginx restart” (enter) everything fine
now
Let’s install https for both the domains

1. After both domain are active on http and we would like to install a certificate

https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx

Follow the instruction on this website

• sudo apt-get update


• sudo apt-get install software-properties-common
• sudo add-apt-repository universe
• sudo add-apt-repository ppa:certbot/certbot
• (enter)
• sudo apt-get update
• sudo apt-get install certbot python-certbot-nginx
• Y
• sudo certbot –nginx
• (email)
• A
• Y
it will ask you to choose website
1. yourfirstwebsite.com
2. www.yourfirstwebsite.com
3. yoursecondwebsite.com
4. www.yoursecondwebsite.com

choose 1-3 and enter


Next it will ask for all to redirect to https enter 2 and enter. DONE

You might also like