-
Notifications
You must be signed in to change notification settings - Fork 220
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 : |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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/ |
There was a problem hiding this comment.
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. | ||
|
||
|
There was a problem hiding this comment.
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.
There was a problem hiding this 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''' |
There was a problem hiding this comment.
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''' |
There was a problem hiding this comment.
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.
updated |
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Test Report Added?:
Test Report:
Special notes for your reviewer: