Difference between revisions of "Adding a New Domain or Subdomain"

From 24PinTech Wiki
Jump to navigation Jump to search
Line 21: Line 21:
Once you have logged into the webserver you will need to create an [[Nginx]] server block. Use the [[Linux Basics for Webserver]] page if any of the commands used are confusing to you. Make sure you have a full understanding of this process otherwise it will be a pain to debug.
Once you have logged into the webserver you will need to create an [[Nginx]] server block. Use the [[Linux Basics for Webserver]] page if any of the commands used are confusing to you. Make sure you have a full understanding of this process otherwise it will be a pain to debug.


Firstly, navigate to the sites-available directory by running the command <code>cd /etc/nginx/sites-available</code>. This directory holds all of the [[Nginx]] website server blocks. These server blocks are what actually lets the website run on the internet. Once in the ''sites-available'' directory you will have access to view/edit all of the other website server blocks. To create a new server block for your domain, run the command <code>sudo touch ./example.org</code> to create the file, then <code>sudo nano ./example.org</code> to edit the file. Alternatively, you may just run the ladder command to create and edit the file.   
Firstly, navigate to the sites-available directory by running the command <code>cd /etc/nginx/sites-available</code>. This directory holds all of the [[Nginx]] website server blocks. These server blocks are what actually lets the website run on the internet. Once in the ''sites-available'' directory you will have access to view/edit all of the other website server blocks. To create a new server block for your domain, run the command <code>sudo touch ./example.org</code> to create the file, then <code>sudo nano ./example.org</code> to edit the file. Alternatively, you may just run the ladder command to create and edit the file. The server blocks have very specific formatting for everything to run correctly. The following is a basic server block that has been commented to increase understanding. 
 
<code>server {</code>  


== New Sub-Domain in Nginx ==
== New Sub-Domain in Nginx ==

Revision as of 16:41, 10 May 2022


New Domains in Nginx

About

Generally speaking, adding a new (website/domain/server block) is very easy in Nginx. A common misconception throughout 24PinTech is that creating a server block is difficult, to try to curb the fear, I will go over adding a new website to our specific server setup.

What you need to start

Procedure

Esxi login.png

Log in to the Nginx Webserver

To begin your process of adding a server block to Nginx navigate to your favorite web browser and type in the address bar, "10.21.25.2". This will take you to our Valhalla ESXi box, this is our ESXi box that hosts all of our production VMs, which is also where devloganweb lives (our Webserver). If you are an administrator on our domain you may log in with your account for the in-class computers, otherwise see a server manager or Bradley Chamberlain for root account access. Navigate to the Webserver VM and log into it using the information provided in the secret sauce.

Creating the Nginx Server Block

Once you have logged into the webserver you will need to create an Nginx server block. Use the Linux Basics for Webserver page if any of the commands used are confusing to you. Make sure you have a full understanding of this process otherwise it will be a pain to debug.

Firstly, navigate to the sites-available directory by running the command cd /etc/nginx/sites-available. This directory holds all of the Nginx website server blocks. These server blocks are what actually lets the website run on the internet. Once in the sites-available directory you will have access to view/edit all of the other website server blocks. To create a new server block for your domain, run the command sudo touch ./example.org to create the file, then sudo nano ./example.org to edit the file. Alternatively, you may just run the ladder command to create and edit the file. The server blocks have very specific formatting for everything to run correctly. The following is a basic server block that has been commented to increase understanding.

server {

New Sub-Domain in Nginx