Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tutorial] What are webservers? #292

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

ayshanimra
Copy link

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind new feature
/kind bug fix
/kind cleanup
/kind revert change
/kind design
/kind documentation
/kind enhancement

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Test Report Added?:

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind TESTED
/kind NOT-TESTED

Test Report:

Special notes for your reviewer:

Copy link
Member

@anvithks anvithks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the review comments


The choice of whether to implement the changes or not will be presented to you. Be aware that you won't be able to enter into the machine again if you deactivate TCP traffic or add a deny OpenSSH rule to the firewall. Let’s now cover some crucial Nginx commands for administration and management

##Nginx Installation and Management :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space after ##

##Nginx Installation and Management :

Step 1: Check the status of the Nginx server:
sudo systemctl status nginx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a code block for commands and code snippets
sudo systemctl status nginx

sudo systemctl status nginx

Step 2: You can also check if Nginx is working by accessing your website using the browser. Visit the following link:
http://servermania_server_ip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the markdown link format [Title](url)

http://servermania_server_ip

Step 3: Use systemctl to start, stop, or restart your Nginx server:
sudo systemctl stop nginxsudo systemctl start nginxsudo systemctl restart nginx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a code block for commands and code snippets.
Add mulitple commands in one line using && or add every command on a new line.

sudo systemctl stop nginxsudo systemctl start nginxsudo systemctl restart nginx

Step 4: The Nginx configuration file is found at /etc/nginx/nginx.conf. If you make changes to the configuration, you can either restart the Nginx server or reload the configuration file.
systemctl reload nginx # reloads Nginx configuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a code block for commands and code snippets

Create a landing page index.html for both domains. Create a basic HTML snippet for a welcome page for both sites.
nano /var/www/domainone.com/html/index.html
Once the editor is open, paste the following into the editor:
<html> <head> <title>Welcome to ServerMania’s Domain One!</title> </head> <body> <h1>You have reached Nginx via Server Block #1</h1> </body></html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a code block for commands and code snippets

Save the index.html file and create a similar one for the second domain. Make sure you change the welcome message.

Step 4: Create Server Blocks:
As mentioned earlier, by default, Nginx has only one server block. You can find it here — /etc/nginx/sites-available/default. So, we'll need two server blocks because we have two sites to support. The server restricts access to port 80. For our new server blocks, let's replicate the default server block.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a code block for commands and code snippets.
You can also use single line code snippets for file paths.


Step 4: Create Server Blocks:
As mentioned earlier, by default, Nginx has only one server block. You can find it here — /etc/nginx/sites-available/default. So, we'll need two server blocks because we have two sites to support. The server restricts access to port 80. For our new server blocks, let's replicate the default server block.
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/domainone.com
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a code block for commands and code snippets


Step 6: Enable Server Blocks & Restart Nginx:
You can enable the server blocks by creating symbolic links from the server block configuration files to the sites-enabled directory.
sudo ln -s /etc/nginx/sites-available/domainone.com /etc/nginx/sites-enabled/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a code block for commands and code snippets

You can try visiting both domains to test the modifications and check to see if the contents of index.html are rendered correctly.
The installation of Nginx on Ubuntu 20.04 can now begin.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a list of references for the content if you have used existing tutorials or blogs.

@anvithks anvithks changed the title webserver tutorial [Tutorial] What are webservers? Apr 3, 2023
Copy link
Member

@anvithks anvithks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check correct usage of code blocks.
Check the formatting of numbered lists. Looks like the code blocks have messed up the numbered list formatting.

Now, you are ready to install Ngnix. When you are logged in with a non-root account with sudo rights, you will need to prefix every task that requires admin privileges with sudo.

Step 2 : Install Ngnix web server using apt:
'''sudo apt install nginxsudo apt-get install nginx'''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. Use single backticks for single line code. Use triple backticks for code blocks.

'''sudo systemctl stop nginxsudo systemctl start nginxsudo systemctl restart nginx'''
my
Step 4: The Nginx configuration file is found at /etc/nginx/nginx.conf. If you make changes to the configuration, you can either restart the Nginx server or reload the configuration file.
'''systemctl reload nginx # reloads Nginx configuration'''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. Use single backticks for single line code. Use triple backticks for code blocks.

@ayshanimra
Copy link
Author

updated

@ayshanimra ayshanimra closed this Apr 16, 2023
@ayshanimra ayshanimra reopened this Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants