Ubuntu下安装、运行Nginx

安装Ubuntu桌面系统(虚拟机)_虚拟机安装ubuntu桌面版-CSDN博客

默认情况下,Ubuntu并没有安装Nginx服务。用户可以使用以下命令安装Nginx服务及其相关的组件:

复制代码
liu@ubuntu:~$ sudo apt install nginx

安装完成之后,使用以下命令启用和启动Nginx服务:

复制代码
liu@ubuntu:~$ sudo systemctl enable nginx
liu@ubuntu:~$ sudo systemctl start nginx

然后查看NFS服务状态,如下所示:

复制代码
liu@ubuntu:~$ 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: active (running) since Tue 2024-01-23 16:45:33 CST; 2min 32s ago
       Docs: man:nginx(8)
   Main PID: 266718 (nginx)
      Tasks: 3 (limit: 4555)
     Memory: 3.9M
        CPU: 36ms
     CGroup: /system.slice/nginx.service
             ├─266718 "nginx: ubuntu process /usr/sbin/nginx -g daemon on; ubuntu_process on;"
             ├─266721 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             └─266722 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

1月 23 16:45:33 ubuntu systemd[1]: Starting A high performance web server and a reverse proxy server...
1月 23 16:45:33 ubuntu systemd[1]: Started A high performance web server and a reverse proxy server.
.

可以发现,Nginx服务已经正常启动了。

用户可以找个浏览器访问Nginx,如下图所示。

本文节选自《Ubuntu Linux运维从零开始学》,获出版社和作者授权发布。

《Ubuntu Linux运维从零开始学 肖志健 清华大学出版社9787302662525》【摘要 书评 试读】- 京东图书 (jd.com)

相关推荐
weixin_4573402110 分钟前
ssh 本地链接服务器地址和服务器查看本地地址
运维·服务器·ssh
海阔天空任鸟飞~8 小时前
Linux 权限 777
linux·运维·服务器
Kina_C11 小时前
Linux iptables 防火墙原理与实操——从四表五链到 NAT 配置
linux·运维·服务器·iptables
TARDIS_202015 小时前
VMware配置ubuntu26.04虚拟机桥接
ubuntu
灵机一物15 小时前
企业选型参考:2026 CXL 内存扩展方案六强测评与落地指南
服务器·网络·数据库·人工智能
Web极客码15 小时前
如何用三段式确定性剪枝,为 LLM Agent 砍掉 35% 的 Token 成本?
服务器·人工智能·算法·机器学习
雷工笔记16 小时前
什么是Ubuntu?
linux·运维·ubuntu
yeflx16 小时前
速腾Airy雷达使用记录
java·服务器·网络
公众号:fuwuqiBMC16 小时前
(转自“服务器BMC”)服务器BMC芯片——多Die(芯片)封装
运维·服务器·人工智能
jsons116 小时前
autofs挂载
linux·服务器·网络