0Pricing
API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) · Aula

Instalação e Configuração do Nginx

Aprenda a instalar o Nginx em vários sistemas operacionais e a realizar as etapas iniciais de configuração.

Instalação e Configuração do Nginx é uma aula grátis de API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway), e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Get Ready to Install Nginx

Welcome! In this lesson, we'll get Nginx up and running on your system. Nginx (pronounced "engine-x") is a powerful web server and reverse proxy that's widely used for high-performance applications.

We'll cover installation on common operating systems and explore its initial setup.

Installing on Linux (APT)

For Debian or Ubuntu Linux, Nginx is readily available through the APT package manager. These commands will update your package list and install Nginx:

  • sudo apt update
  • sudo apt install nginx

The sudo command grants administrative privileges, necessary for system-wide changes.

sudo apt update
sudo apt install nginx

Check Nginx is Running

After installation, Nginx usually starts automatically. You can verify its status using systemctl, a command for controlling system services.

A successful output will show "active (running)". Try running this:

sudo systemctl status nginx

Managing Nginx Service

Knowing how to control the Nginx service is crucial. Here are the most common commands you'll use:

  • Start: sudo systemctl start nginx
  • Stop: sudo systemctl stop nginx
  • Restart: sudo systemctl restart nginx (stops and then starts)
  • Reload: sudo systemctl reload nginx (applies config changes without dropping connections)

Where to Find Configs

Nginx configurations live in specific directories. On Linux systems, the main configuration file is usually located at /etc/nginx/nginx.conf.

This main file often includes other configuration files from the /etc/nginx/sites-available/ directory. These are then symlinked (a type of shortcut) to /etc/nginx/sites-enabled/ to activate them.

Your First Nginx Page

Once Nginx is running, open your web browser and navigate to http://localhost/ or your server's IP address. You should see a default "Welcome to Nginx!" page.

This page confirms Nginx is serving content correctly from its default web root, which is typically /var/www/html.

How Nginx Listens

By default, Nginx listens for incoming web requests on port 80 (the standard HTTP port). This is configured in the nginx.conf file or included server blocks.

You can verify which ports Nginx is listening on using the ss command (Socket Statistics). Try running this example:

sudo ss -ltn | grep 80

Installation on macOS

For macOS users, Homebrew is the easiest way to install Nginx. Homebrew is a popular package manager for macOS.

First, ensure Homebrew is installed. Then, use the brew command to install Nginx and start its service:

brew install nginx
brew services start nginx

Installation Check

Let's test your understanding of basic Nginx service commands.

Recap: Nginx is Installed!

Great job! You've successfully learned how to install Nginx on both Linux and macOS, verify its status, and manage the service with basic commands.

We also touched upon where Nginx stores its configuration files and how to confirm it's serving the default page. In the next lesson, we'll dive into the basic Nginx configuration file structure!

Perguntas Frequentes

A aula “Instalação e Configuração do Nginx” é grátis?

Sim — o texto completo de “Instalação e Configuração do Nginx” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway), atualize para CoddyKit PRO. O curso de API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) inclui 4 aulas no total.

O que vou aprender em “Instalação e Configuração do Nginx”?

Aprenda a instalar o Nginx em vários sistemas operacionais e a realizar as etapas iniciais de configuração. Você pratica API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)?

Nenhuma experiência prévia é necessária. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.

Quanto tempo leva a aula “Instalação e Configuração do Nginx”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)?

Sim. Cada aula de API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Instalação e Configuração do Nginx
  2. Configuração Básica do Nginx
  3. Disponibilização de Conteúdo Estático com Nginx
  4. Blocos de localização e correspondência de solicitações no Nginx
← Voltar para API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)