nginx command not found

In this troubleshooting guide we learn how to fix nginx command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

nginx: command not found

or when using sudo you get the following error message

sudo: nginx: command not found

Solutions to nginx: command not found

How To Fix nginx: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu nginx is provided by nginx-core package.

nginx-core is:

Nginx (“engine X”) is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers.

This package provides a version of nginx identical to that of nginx-full, but without any third-party modules, and only modules in the original nginx code base.

STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Browser, Empty GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy, Referer, Rewrite, SCGI, Split Clients, UWSGI.

OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, Gunzip, Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, Real IP, Slice, SSI, SSL, SSL Preread, Stub Status, Substitution, Thread Pool, Upstream, User ID, XSLT.

THIRD PARTY HTTP MODULES: GeoIP2

OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP.

OPTIONAL STREAM MODULES: Stream Core

To fix this problem, we can install more using the command below.

sudo apt-get -y install nginx-core

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install nginx-core.

sudo apt -y install nginx-core

Or if you have aptitude installed you can use the following command.

sudo aptitude install nginx-core

Summary

In this tutorial we learn how to fix nginx command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.