系统相关
首页 > 系统相关> > 一、ubuntu安装nginx

一、ubuntu安装nginx

作者:互联网

本文描述一个新系统下,安装使用nginx。

1、先更新软件:

sudo apt update

2、安装依赖包:

sudo apt install libpcre3 libpcre3-dev

3、安装nginx:

sudo apt install nginx

安装完成后,正常情况下nginx自动运行,可以使用下面命令查看状态

service nginx status
● 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 Mon 2022-06-13 17:46:00 CST; 19s ago
       Docs: man:nginx(8)
   Main PID: 2688 (nginx)
      Tasks: 2 (limit: 2310)
     Memory: 6.2M
     CGroup: /system.slice/nginx.service
             ├─2688 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─2689 nginx: worker process

Jun 13 17:46:00 hui systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 13 17:46:00 hui systemd[1]: Started A high performance web server and a reverse proxy server.

4、查看nginx欢迎页面:

root@hui:~# curl 127.0.0.1
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>

出现以上页面,说明nginx工作正常

5、使用浏览器,输入公网IP,则可以看到正常的欢迎页面

 

标签:web,systemd,17,service,server,nginx,ubuntu,安装
来源: https://www.cnblogs.com/rodius/p/16371778.html