Quick steps to install Nginx on Ubuntu Linux


Quickly setup nginx server
Quickly setup nginx server
  • Step 1: Update your apt package manager by running command: sudo apt update,
  • Step 2: Now lets run the command sudo apt install nginx,
    # sudo apt install nginx 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      fontconfig-config fonts-dejavu-core iproute2 libatm1 libbsd0 libcap2-bin libelf1
       ...
       ...
      libxau6 libxcb1 libxdmcp6 libxpm4 libxslt1.1 libxtables12 nginx-common nginx-core
      ucf
    Suggested packages:
      iproute2-doc libgd-tools fcgiwrap nginx-doc
    The following NEW packages will be installed:
      fontconfig-config ... ... nginx nginx-common
      nginx-core ucf
    0 upgraded, 34 newly installed, 0 to remove and 19 not upgraded.
    Need to get 4755 kB of archives.
    After this operation, 15.9 MB of additional disk space will be used.
    
    Do you want to continue? [Y/n] Y
    
    Get:1 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libbsd0 arm64 0.10.0-1 [43.7 kB]
    Get:2 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libelf1 arm64 0.176-1.1build1 [44.2 kB]
    Get:3 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libmnl0 arm64 1.0.4-2 [11.3 kB]
    ...
    ...
    Get:32 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 libnginx-mod-stream arm64 1.18.0-0ubuntu1.2 [63.2 kB]
    Get:33 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 nginx-core arm64 1.18.0-0ubuntu1.2 [399 kB]
    Get:34 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 nginx all 1.18.0-0ubuntu1.2 [3620 B]
    ...
    ...
    Fetched 4755 kB in 5s (951 kB/s) 
    debconf: delaying package configuration, since apt-utils is not installed
    Selecting previously unselected package libbsd0:arm64.
    (Reading database ... 11528 files and directories currently installed.)
    Preparing to unpack .../00-libbsd0_0.10.0-1_arm64.deb ...
    Unpacking libbsd0:arm64 (0.10.0-1) ...
    ...
    Setting up libnginx-mod-http-image-filter (1.18.0-0ubuntu1.2) ...
    Setting up nginx-core (1.18.0-0ubuntu1.2) ...
    Not attempting to start NGINX, port 80 is already in use.
    Setting up nginx (1.18.0-0ubuntu1.2) ...
    Processing triggers for systemd (245.4-4ubuntu3.15) ...
    Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
    
    Progress: [ 99%] [#############################################################]
  • Step 3: Now lets create a sample html page,
    # cd /var/www
    # mkdir root
    # cd root
    # nano index.html

    Add a sample html content in the index.html file to test,

    <h1>Hello from Nginx Server on Ubuntu!&tl;/h1>
  • Step 4: Now lets start the server: # sudo service nginx start
  • Step 5: Now lets test that the server is up,
    curl localhost/root/index.html
    
    <h1>Hello from Nginx Server on Ubuntu!</h1>
Advertisements
Try Out Code2care Dev Tools:

Advertisements



#Android #Java #Linux #Microsoft #Google #Python #MacOS #Notepad++ #Microsoft Teams #CSS #PHP #SharePoint #Html #Linux #C-Program #Bootstrap #jQuery #Sublime #Android-Studio #Facebook #Eclipse #WhatsApp #News #MySQL #Json #HowTos #JavaScript #FTP #S3


Advertisements


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR - https://donate.unhcr.org/in/en-in/ukraine-emergency