• Home
  • Ubuntu
  • Debian
  • Linux
  • Commands
No Result
View All Result
TECH DHEE
  • Home
  • Ubuntu
  • Debian
  • Linux
  • Commands
No Result
View All Result
TECH DHEE
No Result
View All Result
Home Ubuntu

How To Install Nginx on Ubuntu 22.04

techdhee by techdhee
February 14, 2023
0 0
0
Install Nginx on Ubuntu

In this guide, you’ll learn how to install Nginx on your Ubuntu 22.04 LTS and about important Nginx files and directories. Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or reverse proxy.

Contents hide
1 What you’ll learn
2 What you’ll need
3 Install Nginx on Ubuntu
3.1 Update your Nginx
3.2 Installing Nginx
4 Checking your Web Server
5 Some nginx Commands
6 Conclusion
7 Finally

What you’ll learn

  • How to set up Nginx
  • Some basic Nginx configuration

What you’ll need

  • Ubuntu Desktop or Server
  • Sudo-privileged user account
  • Basic Linux command line knowledge

Install Nginx on Ubuntu

Update your Nginx

$ sudo apt update

Install Nginx on Ubuntu 22.04

Installing Nginx

You can install Nginx using the following command.

You can install nginx using the following command.

$ sudo apt install nginx

techdhee@ubuntu:~|⇒  sudo apt install nginx[sudo] password for techdhee: ================================================================================ Auto-Removing                                                                  ================================================================================  Package:                  Version:                                     Size:    linux-image-5.13.0-52-g…  5.13.0-52.59                               10.3 MB    linux-modules-5.13.0-52…  5.13.0-52.59                              100.0 MB                                                                                  ================================================================================ Installing                                                                     ================================================================================  Package:                  Version:                                     Size:    libnginx-mod-http-geoip2  1.18.0-6ubuntu14.2                           12 KB    libnginx-mod-http-image…  1.18.0-6ubuntu14.2                           15 KB    libnginx-mod-http-xslt-…  1.18.0-6ubuntu14.2                           14 KB    libnginx-mod-mail         1.18.0-6ubuntu14.2                           46 KB    libnginx-mod-stream       1.18.0-6ubuntu14.2                           73 KB    libnginx-mod-stream-geo…  1.18.0-6ubuntu14.2                           10 KB    nginx                     1.18.0-6ubuntu14.2                            4 KB    nginx-common              1.18.0-6ubuntu14.2                           40 KB    nginx-core                1.18.0-6ubuntu14.2                          482 KB                                                                                  ================================================================================ Suggested, Will Not Be Installed                                               ================================================================================  Package:                  Version:                                     Size:    fcgiwrap                  1.1.0-12                                     17 KB    nginx-doc                 1.18.0-6ubuntu14.2                           14 KB    nginx-doc                 1.18.0-6ubuntu14.2                           14 KB                                                                                  ================================================================================ Summary                                                                        ================================================================================ Auto-Remove 2 Packages                                                          Install     9 Packages                                                                                                                                          Total download size    696 KB    Disk space to free   107.9 MB                                    Do you want to continue? [Y/n] Do you want to continue? [Y/n] Y╭─ Downloading… ───────────────────────────────────────────────────────────────╮│ Total Packages: 9/9                                                          ││ Last Completed: nginx_1.18.0-6ubuntu14.2_amd64.deb                           ││ Time Remaining: 0:00:00 ━━━━━━━━━━━━━━━ 100.0% • 695.5/695.5 KB • 405.7 KB/s │╰──────────────────────────────────────────────────────────────────────────────╯╭─ Installing Packages ────────────────────────────────────────────────────────╮│Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /…││Setting up: libnginx-mod-http-xslt-filter (1.18.0-6ubuntu14.2)                ││Setting up: libnginx-mod-http-geoip2 (1.18.0-6ubuntu14.2)                     ││Setting up: libnginx-mod-mail (1.18.0-6ubuntu14.2)                            ││Setting up: libnginx-mod-http-image-filter (1.18.0-6ubuntu14.2)               ││Setting up: libnginx-mod-stream (1.18.0-6ubuntu14.2)                          ││Setting up: libnginx-mod-stream-geoip2 (1.18.0-6ubuntu14.2)                   ││Setting up: nginx-core (1.18.0-6ubuntu14.2)                                   ││* Upgrading binary nginx        [ OK ]                                        ││Setting up: nginx (1.18.0-6ubuntu14.2)                                        ││Processing: triggers for man-db (2.10.2-1)                                    ││Processing: triggers for ufw (0.36.1-4build1)                                 ││╭────────────────────────────────────────────────────────────────────────────╮│││✔ Running dpkg … ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00 • 23/23│││╰────────────────────────────────────────────────────────────────────────────╯│╰──────────────────────────────────────────────────────────────────────────────╯Notices:  Warning: os-prober will not be executed to detect other bootable partitions.Finished Successfullytechdhee@ubuntu:~|⇒  Do you want to continue? [Y/n] Y╭─ Downloading… ───────────────────────────────────────────────────────────────╮│ Total Packages: 9/9                                                          ││ Last Completed: nginx_1.18.0-6ubuntu14.2_amd64.deb                           ││ Time Remaining: 0:00:00 ━━━━━━━━━━━━━━━ 100.0% • 695.5/695.5 KB • 405.7 KB/s │╰──────────────────────────────────────────────────────────────────────────────╯╭─ Installing Packages ────────────────────────────────────────────────────────╮│Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /…││Setting up: libnginx-mod-http-xslt-filter (1.18.0-6ubuntu14.2)                ││Setting up: libnginx-mod-http-geoip2 (1.18.0-6ubuntu14.2)                     ││Setting up: libnginx-mod-mail (1.18.0-6ubuntu14.2)                            ││Setting up: libnginx-mod-http-image-filter (1.18.0-6ubuntu14.2)               ││Setting up: libnginx-mod-stream (1.18.0-6ubuntu14.2)                          ││Setting up: libnginx-mod-stream-geoip2 (1.18.0-6ubuntu14.2)                   ││Setting up: nginx-core (1.18.0-6ubuntu14.2)                                   ││* Upgrading binary nginx        [ OK ]                                        ││Setting up: nginx (1.18.0-6ubuntu14.2)                                        ││Processing: triggers for man-db (2.10.2-1)                                    ││Processing: triggers for ufw (0.36.1-4build1)                                 ││╭────────────────────────────────────────────────────────────────────────────╮│││✔ Running dpkg … ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00 • 23/23│││╰────────────────────────────────────────────────────────────────────────────╯│╰──────────────────────────────────────────────────────────────────────────────╯Notices:  Warning: os-prober will not be executed to detect other bootable partitions.Finished Successfullytechdhee@ubuntu:~|⇒

After installing all required packages we have to start the nginx services using the following command.

sudo systemctl start nginx.service

Use the command below for init.d systems:

sudo systemctl start nginx

Checking your Web Server

$ sudo systemctl status nginx

Install Nginx on Ubuntu 22.04

As confirmed by this output, the service has started successfully. However, the best way to test this is to request a page from nginx.

Now you can open the web browser and in the web browser, you can enter the website link or IP address. But if you are using a local machine then you can use localhost or 127.0.0.1.

Install Nginx on Ubuntu 22.04

If you see the page above, it means that nginx has been successfully installed on your server! Let’s move on.

Some nginx Commands

Now our nginx web server is working on Ubuntu. Let’s go with some management commands of the nginx web server.

To stop the web server or nginx:

sudo systemctl stop nginx

Start the web server or nginx:

$ sudo systemctl start nginx

To restart the web server:

$ sudo systemctl restart nginx

Reload the web server, nginx can often reload without dropping connections.  To do this, use this command:

$ sudo systemctl reload nginx

By default, nginx is configured to start automatically when the server boots.  If this is not what you want, disable this behavior by using this command:

$ sudo systemctl disable nginx

To re-enable the service to start up at boot. For this, use this command:

$ sudo systemctl enable nginx

This is the way how you install the nginx web server on Ubuntu 22.04 and use your services using the web server.

Conclusion

Now that you have your web server installed, you have many options for the type of content to serve and the technologies you want to use to create a richer experience.

Finally

Thank you for reading this post and keep connected to TECH DHEE to continue enjoying excellent posts. Share your views about this post in the comment section below. If you still have any queries, throw them in the comment section. If you find this post helpful, don’t hesitate to share this post on your social network. It will only take a moment, and also it is quite easy and useful for others.

If you have any questions, feel free to leave a comment.

Related Posts:

  • How to Create a File in Linux
  • Su Command in Linux
  • Nala – An Alternative To APT Package Manager
  • Install Nano Text Editor in Linux
  • Linux File Hierarchy Structure
  • Whoami command in Linux
ShareTweetSendShareSend
Previous Post

How To Install kaboxer on Kali Linux 2022.4

Next Post

Nala – An Alternative To APT Package Manager

techdhee

techdhee

Related Posts

Debian

How to install Tweak Tool on Ubuntu 22.04 LTS

March 3, 2023
Install Ngrok on Ubuntu 22.04 LTS
Debian

How to Install Ngrok on Ubuntu 22.04 LTS

March 2, 2023
Debian

How To Install the Apache2 on Ubuntu 22.04

March 1, 2023
Debian

Install Open VM Tools on Debian 11 Bullseye

February 26, 2023
Install VLC on Ubuntu 22.04
Ubuntu

How to Install VLC on Ubuntu 22.04 LTS

February 25, 2023
Install Nano Text Editor in Linux
Commands

How to Install Nano Text Editor in Linux

February 24, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You might also like

How-to-Check-Windows-10-is-Genuine-or-Not-Genuine

How to Check Windows 10 is Genuine or Not Genuine

August 6, 2023
How to Install Arch Linux

How to Install Arch Linux [Step by Step Guide]

August 6, 2023
Terminal Emulators for Linux

Top 6 Terminal Emulators for Linux

August 5, 2023
How to Install Tor Browser in Kali Linux 2023.1

How to Install Tor Browser in Kali Linux 2023.1

April 2, 2023

How to install Tweak Tool on Ubuntu 22.04 LTS

March 3, 2023
Install Ngrok on Ubuntu 22.04 LTS

How to Install Ngrok on Ubuntu 22.04 LTS

March 2, 2023

© 2024 tecdhee.com - Tech Tips, Tricks and Tutorials.

  • Home
  • About Us
  • Contact
  • Disclaimer
  • Privacy Policy
No Result
View All Result
  • About Us
  • Contact
  • Disclaimer
  • Home
  • Privacy Policy

© 2024 tecdhee.com - Linux Tips, Tricks and Tutorials.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In