掘金 后端 ( ) • 2024-05-14 09:00

windows10 + WSL ubuntu 安装 nginx 实战笔记

在Ubuntu上安装Nginx通常是一个相对简单的过程。你可以通过以下步骤进行安装:

  1. 打开终端。
  2. 运行以下命令以更新系统的软件包列表:
sudo apt update
  1. 安装Nginx:
sudo apt install nginx
  1. 安装完成后,可以使用以下命令启动Nginx服务:
sudo systemctl start nginx
  1. 如果你希望Nginx在系统启动时自动启动,可以运行以下命令:
sudo systemctl enable nginx

现在,Nginx已经安装并运行在你的Ubuntu系统上。你可以通过在浏览器中输入服务器的IP地址或域名来验证是否成功安装。

如果一切顺利,你应该能够看到Nginx的欢迎页面。

  1. 验证方式

浏览器的话,可以看到对应的欢迎页面。

$ curl http://localhost

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

拓展阅读

Nginx-01-聊一聊 nginx

Nginx-01-Nginx 是什么

Nginx-02-为什么使用 Nginx

Nginx-02-Nginx Ubuntu 安装 + windows10 + WSL ubuntu 安装 nginx 实战笔记

Nginx-02-基本使用

Nginx-03-Nginx 项目架构

Nginx-04-Docker Nginx

Nginx-05-nginx 反向代理是什么?windows 下如何配置使用 nginx

Nginx-06-nginx 汇总入门介绍

Nginx R31 doc 官方文档-01-nginx 如何安装

Nginx R31 doc-02-nginx 基本功能

Nginx R31 doc-03-HTTP Load Balancing HTTP 负载均衡

Nginx R31 doc-04-HTTP Health Checks

Nginx R31 doc-05-Dynamic Configuration of Upstreams with the NGINX Plus API 使用 NGINX Plus API 动态配置上游服务器

Nginx R31 doc-06-Accepting the PROXY Protocol

Nginx R31 doc-07-内容缓存

Nginx R31 doc-08-Configuring NGINX and NGINX Plus as a Web Server 配置 NGINX 和 NGINX Plus 作为 Web 服务器

Nginx R31 doc-09-Serving Static Content 静态内容

Nginx R31 doc-10-NGINX Reverse Proxy 反向代理

Nginx R31 doc-11-Compression and Decompression 压缩与解压缩

Nginx R31 doc-12-NGINX SSL Termination 安全加密