Install nginx on Linux

To install nginx on your linux distribution make sure that port 80 is free. In your terminal type ” sudo apt-get install nginx”

jill@VM-00:~$ sudo apt-get install nginx

If port 80 is used by another process you will get the following message when ckecking the status of nginx sever.

jill@VM-00:~$ sudo systemctl status nginx
 nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-09-28 20:13:33 EDT; 2min 55s ago
       Docs: man:nginx(8)
    Process: 3929 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 3930 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 10ms

  • To stop nginx :
jill@VM-00:~$ sudo systemctl stop nginx
  • To start nginx:
jill@VM-00:~$ sudo systemctl stop nginx
  • To restart nginx:
jill@VM-00:~$ sudo systemctl restart nginx

Related Post

Leave a Reply

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