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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update readme.md
ayshanimra authored Apr 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 46f5380dba9227ef7a7eefd5d555406a21ae9d02
33 changes: 13 additions & 20 deletions learning/dashboard/webserver/readme.md
Original file line number Diff line number Diff line change
@@ -63,11 +63,11 @@ A package manager is typically included with every operating system. You have a

Step 1 : Upgrade the package management to the most recent version that is compatible:
You can either use the apt or apt-get package manager to install Nginx.
'''sudo apt updatesudo apt-get update'''
sudo apt updatesudo apt-get update
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'''
sudo apt install nginxsudo apt-get install nginx

Although the service starts automatically after installing Nginx, before you can test whether Nginx is working correctly or not, you will need to configure the OS firewall to access Nginx.

@@ -76,36 +76,36 @@ Although the service starts automatically after installing Nginx, before you can
The most popular method for creating iptables' ingress and egress rules. Uncomplicated Firewall, or ufw, is a user-friendly wrapper for iptables that is available in Ubuntu 20.04. Although it comes installed with Ubuntu 20.04 but to make sure that it is appropriately installed, install it manually. After installing Nginx, follow the instructions below to set up the firewall

Step 1: Install ufw:
```sudo apt install ufw```
sudo apt install ufw

Step 2: Check if ufw is working fine:
```sudo ufw status```
sudo ufw status

Step 3: Allow traffic over HTTP and recheck the status:
```sudo ufw allow ‘Nginx HTTP’ ```
sudo ufw allow ‘Nginx HTTP’

Step 4: Allow traffic over TCP (OpenSSH) too if you want to log into the machine again:
```sudo ufw allow ‘OpenSSH’ ```
sudo ufw allow ‘OpenSSH’

Step 5: If the status was inactive when you checked earlier, activate it:
```sudo ufw enable```
sudo ufw enable

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 :

Step 1: Check the status of the Nginx server:
``` 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)


Step 3: Use systemctl to start, stop, or restart your Nginx server:
```sudo systemctl stop nginxsudo systemctl start```
``` nginxsudo systemctl restart nginx```
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```
systemctl reload nginx # reloads Nginx configuration

Use the reload command rather than the restart command whenever possible because it doesn't affect any current connections you may have to Nginx.

@@ -119,15 +119,14 @@ Create a directory, one for each domain:

Nginx only creates one server block by default, and it points to the /var/www/html directory. If you simply had one site, this would function flawlessly. All of the website's content is housed in the html subdirectory. For both of your domains, create the html subdirectories.

```sudo mkdir -p /var/www/domainone.com/htmlsudo mkdir -p /var/www/domaintwo.com/html```
sudo mkdir -p /var/www/domainone.com/htmlsudo mkdir -p /var/www/domaintwo.com/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


Step 1: Change ownership of the directories:
Doing this will enable the user to create and edit the contents of these new directories.
```sudo chown -R $user:$user /var/www/domainone.com/htmlsudo chown -R $user:$user /var/www/domaintwo.com/html```

Step 2: Modify permissions for both the domain directories:
This step is important to make sure that you don’t need root privileges to make changes to any of the sites.
```sudo chmod -R 755 /var/www```
sudo chmod -R 755 /var/www
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 3: Create sample web pages for each domain/site:
Create a landing page index.html for both domains. Create a basic HTML snippet for a welcome page for both sites.
@@ -154,13 +153,7 @@ You can try visiting both domains to test the modifications and check to see if
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.

# Reference

https://www.techtarget.com/whatis/definition/Web-server#:~:text=A%20web%20server%20is%20software,and%20delivering%20webpages%20to%20users.

https://www.solarwinds.com/resources/it-glossary/web-server#:~:text=servers%20used%20for%3F-,What%20are%20web%20servers%20used%20for%3F,website%20data%20from%20unauthorized%20users.

https://ubuntu.com/tutorials/install-and-configure-nginx#2-installing-nginx