1.编译安装nginx
编译安装:三部曲
- 配置(configure),编译(make),安装(make install)
- 配置(configure) 指定安装目录
- 编译(make) 源代码---编译工具-->可执行文件(命令)
- 安装(make install) 根据第1步骤的配置,创建目录,复制文件,复制目录.
1.1 Kylin_v10_sp3安装
[root@Kylin-V10-sp3 ~/app/packages]# rz[root@Kylin-V10-sp3 ~/app/packages]# ll
总用量 2404
-rw-r--r-- 1 root root 1244789 9月 3 2024 nginx-1.26.2.tar.gz
-rw-r--r-- 1 root root 64340 8月 30 23:40 telnet-0.17-77.ky10.x86_64.rpm
-rw-r--r-- 1 root root 52192 8月 30 23:40 tree-1.8.0-2.ky10.x86_64.rpm
-rw-r--r-- 1 root root 517992 2月 14 2022 zabbix-agent-6.0.0-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 574100 4月 22 15:10 zabbix-agent-6.0.29-release1.el7.x86_64.rpm
[root@Kylin-V10-sp3 ~/app/packages]#
[root@Kylin-V10-sp3 ~/app/packages]#
# 解压
[root@Kylin-V10-sp3 ~/app/packages]# tar xf nginx-1.26.2.tar.gz
[root@Kylin-V10-sp3 ~/app/packages]#
[root@Kylin-V10-sp3 ~/app/packages]# ll
总用量 2404
drwxr-xr-x 8 502 games 158 8月 13 00:39 nginx-1.26.2
-rw-r--r-- 1 root root 1244789 9月 3 2024 nginx-1.26.2.tar.gz
-rw-r--r-- 1 root root 64340 8月 30 23:40 telnet-0.17-77.ky10.x86_64.rpm
-rw-r--r-- 1 root root 52192 8月 30 23:40 tree-1.8.0-2.ky10.x86_64.rpm
-rw-r--r-- 1 root root 517992 2月 14 2022 zabbix-agent-6.0.0-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 574100 4月 22 15:10 zabbix-agent-6.0.29-release1.el7.x86_64.rpm
[root@Kylin-V10-sp3 ~/app/packages]#
# 下载依赖包
[root@Kylin-V10-sp3 ~/app/packages]# yum install -y pcre-devel openssl-devel
上次元数据过期检查:0:07:46 前,执行于 2024年08月31日 星期六 01时32分57秒。
软件包 pcre-devel-8.44-2.ky10.x86_64 已安装。
软件包 openssl-devel-1:1.1.1f-15.p05.ky10.x86_64 已安装。
依赖关系解决。
======================================================================================================================================================Package Architecture Version Repository Size
======================================================================================================================================================
升级:openssl x86_64 1:1.1.1f-15.p25.ky10 ks10-adv-updates 455 kopenssl-devel x86_64 1:1.1.1f-15.p25.ky10 ks10-adv-updates 1.8 Mopenssl-help noarch 1:1.1.1f-15.p25.ky10 ks10-adv-updates 3.2 Mopenssl-libs x86_64 1:1.1.1f-15.p25.ky10 ks10-adv-updates 1.4 M事务概要
======================================================================================================================================================
升级 4 软件包总下载:6.8 M
下载软件包:
(1/4): openssl-1.1.1f-15.p25.ky10.x86_64.rpm 164 kB/s | 455 kB 00:02
(2/4): openssl-devel-1.1.1f-15.p25.ky10.x86_64.rpm 144 kB/s | 1.8 MB 00:12
(3/4): openssl-libs-1.1.1f-15.p25.ky10.x86_64.rpm 129 kB/s | 1.4 MB 00:11
(4/4): openssl-help-1.1.1f-15.p25.ky10.noarch.rpm 200 kB/s | 3.2 MB 00:16
------------------------------------------------------------------------------------------------------------------------------------------------------
总计 430 kB/s | 6.8 MB 00:16
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务准备中 : 1/1 升级 : openssl-libs-1:1.1.1f-15.p25.ky10.x86_64 1/8 运行脚本: openssl-libs-1:1.1.1f-15.p25.ky10.x86_64 1/8 升级 : openssl-help-1:1.1.1f-15.p25.ky10.noarch 2/8 升级 : openssl-1:1.1.1f-15.p25.ky10.x86_64 3/8 升级 : openssl-devel-1:1.1.1f-15.p25.ky10.x86_64 4/8 清理 : openssl-1:1.1.1f-15.p05.ky10.x86_64 5/8 清理 : openssl-devel-1:1.1.1f-15.p05.ky10.x86_64 6/8 清理 : openssl-help-1:1.1.1f-15.p05.ky10.noarch 7/8 清理 : openssl-libs-1:1.1.1f-15.p05.ky10.x86_64 8/8 运行脚本: openssl-libs-1:1.1.1f-15.p05.ky10.x86_64 8/8 验证 : openssl-1:1.1.1f-15.p25.ky10.x86_64 1/8 验证 : openssl-1:1.1.1f-15.p05.ky10.x86_64 2/8 验证 : openssl-devel-1:1.1.1f-15.p25.ky10.x86_64 3/8 验证 : openssl-devel-1:1.1.1f-15.p05.ky10.x86_64 4/8 验证 : openssl-help-1:1.1.1f-15.p25.ky10.noarch 5/8 验证 : openssl-help-1:1.1.1f-15.p05.ky10.noarch 6/8 验证 : openssl-libs-1:1.1.1f-15.p25.ky10.x86_64 7/8 验证 : openssl-libs-1:1.1.1f-15.p05.ky10.x86_64 8/8 已升级:openssl-1:1.1.1f-15.p25.ky10.x86_64 openssl-devel-1:1.1.1f-15.p25.ky10.x86_64 openssl-help-1:1.1.1f-15.p25.ky10.noarch openssl-libs-1:1.1.1f-15.p25.ky10.x86_64 完毕!
[root@Kylin-V10-sp3 ~/app/packages]# [root@Kylin-V10-sp3 ~/app/packages]# cd nginx-1.26.2/
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]#
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# ll
总用量 828
drwxr-xr-x 6 502 games 326 8月 31 01:39 auto
-rw-r--r-- 1 502 games 327851 8月 13 00:39 CHANGES
-rw-r--r-- 1 502 games 501527 8月 13 00:39 CHANGES.ru
drwxr-xr-x 2 502 games 168 8月 31 01:39 conf
-rwxr-xr-x 1 502 games 2611 8月 12 22:28 configure
drwxr-xr-x 4 502 games 72 8月 31 01:39 contrib
drwxr-xr-x 2 502 games 40 8月 31 01:39 html
-rw-r--r-- 1 502 games 1397 8月 12 22:28 LICENSE
drwxr-xr-x 2 502 games 21 8月 31 01:39 man
-rw-r--r-- 1 502 games 49 8月 12 22:28 README
drwxr-xr-x 9 502 games 91 8月 13 00:39 src
# 配置安装目录和运行的用户nginx
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# ./configure --prefix=/app/tools/nginx-1.26.2/ --user=nginx --group=nginx
Configuration summary+ using system PCRE2 library+ OpenSSL library is not used+ using system zlib librarynginx path prefix: "/app/tools/nginx-1.26.2/"nginx binary file: "/app/tools/nginx-1.26.2//sbin/nginx"nginx modules path: "/app/tools/nginx-1.26.2//modules"nginx configuration prefix: "/app/tools/nginx-1.26.2//conf"nginx configuration file: "/app/tools/nginx-1.26.2//conf/nginx.conf"nginx pid file: "/app/tools/nginx-1.26.2//logs/nginx.pid"nginx error log file: "/app/tools/nginx-1.26.2//logs/error.log"nginx http access log file: "/app/tools/nginx-1.26.2//logs/access.log"nginx http client request body temporary files: "client_body_temp"nginx http proxy temporary files: "proxy_temp"nginx http fastcgi temporary files: "fastcgi_temp"nginx http uwsgi temporary files: "uwsgi_temp"nginx http scgi temporary files: "scgi_temp"[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]#
# 检查上一个命令是否运行成功 0正常,其他数字异常
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# echo $?
0
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]#
# 编译 -j 1 使用1个核心
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# make -j 1
objs/ngx_modules.o \
-ldl -lpthread -lcrypt -lpcre2-8 -lz \
-Wl,-E
sed -e "s|%%PREFIX%%|/app/tools/nginx-1.26.2/|" \-e "s|%%PID_PATH%%|/app/tools/nginx-1.26.2//logs/nginx.pid|" \-e "s|%%CONF_PATH%%|/app/tools/nginx-1.26.2//conf/nginx.conf|" \-e "s|%%ERROR_LOG_PATH%%|/app/tools/nginx-1.26.2//logs/error.log|" \< man/nginx.8 > objs/nginx.8
make[1]: 离开目录“/root/app/packages/nginx-1.26.2”
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]#
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# echo $?
0
# 安装
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# make install
make -f objs/Makefile install
make[1]: 进入目录“/root/app/packages/nginx-1.26.2”
test -d '/app/tools/nginx-1.26.2/' || mkdir -p '/app/tools/nginx-1.26.2/'
test -d '/app/tools/nginx-1.26.2//sbin' \|| mkdir -p '/app/tools/nginx-1.26.2//sbin'
test ! -f '/app/tools/nginx-1.26.2//sbin/nginx' \|| mv '/app/tools/nginx-1.26.2//sbin/nginx' \'/app/tools/nginx-1.26.2//sbin/nginx.old'
cp objs/nginx '/app/tools/nginx-1.26.2//sbin/nginx'
test -d '/app/tools/nginx-1.26.2//conf' \|| mkdir -p '/app/tools/nginx-1.26.2//conf'
cp conf/koi-win '/app/tools/nginx-1.26.2//conf'
cp conf/koi-utf '/app/tools/nginx-1.26.2//conf'
cp conf/win-utf '/app/tools/nginx-1.26.2//conf'
test -f '/app/tools/nginx-1.26.2//conf/mime.types' \|| cp conf/mime.types '/app/tools/nginx-1.26.2//conf'
cp conf/mime.types '/app/tools/nginx-1.26.2//conf/mime.types.default'
test -f '/app/tools/nginx-1.26.2//conf/fastcgi_params' \|| cp conf/fastcgi_params '/app/tools/nginx-1.26.2//conf'
cp conf/fastcgi_params \'/app/tools/nginx-1.26.2//conf/fastcgi_params.default'
test -f '/app/tools/nginx-1.26.2//conf/fastcgi.conf' \|| cp conf/fastcgi.conf '/app/tools/nginx-1.26.2//conf'
cp conf/fastcgi.conf '/app/tools/nginx-1.26.2//conf/fastcgi.conf.default'
test -f '/app/tools/nginx-1.26.2//conf/uwsgi_params' \|| cp conf/uwsgi_params '/app/tools/nginx-1.26.2//conf'
cp conf/uwsgi_params \'/app/tools/nginx-1.26.2//conf/uwsgi_params.default'
test -f '/app/tools/nginx-1.26.2//conf/scgi_params' \|| cp conf/scgi_params '/app/tools/nginx-1.26.2//conf'
cp conf/scgi_params \'/app/tools/nginx-1.26.2//conf/scgi_params.default'
test -f '/app/tools/nginx-1.26.2//conf/nginx.conf' \|| cp conf/nginx.conf '/app/tools/nginx-1.26.2//conf/nginx.conf'
cp conf/nginx.conf '/app/tools/nginx-1.26.2//conf/nginx.conf.default'
test -d '/app/tools/nginx-1.26.2//logs' \|| mkdir -p '/app/tools/nginx-1.26.2//logs'
test -d '/app/tools/nginx-1.26.2//logs' \|| mkdir -p '/app/tools/nginx-1.26.2//logs'
test -d '/app/tools/nginx-1.26.2//html' \|| cp -R html '/app/tools/nginx-1.26.2/'
test -d '/app/tools/nginx-1.26.2//logs' \|| mkdir -p '/app/tools/nginx-1.26.2//logs'
make[1]: 离开目录“/root/app/packages/nginx-1.26.2”
[root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# [root@Kylin-V10-sp3 ~/app/packages/nginx-1.26.2]# cd /app/tools/nginx-1.26.2/
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# ll
总用量 0
drwxr-xr-x 2 root root 333 8月 31 01:51 conf
drwxr-xr-x 2 root root 40 8月 31 01:51 html
drwxr-xr-x 2 root root 6 8月 31 01:51 logs
drwxr-xr-x 2 root root 19 8月 31 01:51 sbin
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# 给/app/tools/nginx-1.26.0/创建软连接/app/tools/nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# ln -s /app/tools/nginx-1.26.2/ /app/tools/nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# id nginx
id: “nginx”:无此用户
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# 添加虚拟用户nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# useradd -s /sbin/nologin -M nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# 检查nginx用户是否存在
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# id nginx
用户id=1003(nginx) 组id=1003(nginx) 组=1003(nginx)
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# 检查80端口是否被占用.
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# ss -lntup
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:* users:(("chronyd",pid=740,fd=6))
udp UNCONN 0 0 [::1]:323 [::]:* users:(("chronyd",pid=740,fd=7))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=856,fd=5))
tcp LISTEN 0 128 0.0.0.0:10050 0.0.0.0:* users:(("zabbix_agentd",pid=16018,fd=7),("zabbix_agentd",pid=16017,fd=7),("zabbix_agentd",pid=16016,fd=7),("zabbix_agentd",pid=16015,fd=7),("zabbix_agentd",pid=16014,fd=7),("zabbix_agentd",pid=16013,fd=7))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=856,fd=6))
tcp LISTEN 0 128 [::]:10050 [::]:* users:(("zabbix_agentd",pid=16018,fd=8),("zabbix_agentd",pid=16017,fd=8),("zabbix_agentd",pid=16016,fd=8),("zabbix_agentd",pid=16015,fd=8),("zabbix_agentd",pid=16014,fd=8),("zabbix_agentd",pid=16013,fd=8))
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# 检查ngx版本信息
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# /app/tools/nginx/sbin/nginx -V
nginx version: nginx/1.26.2
built by gcc 7.3.0 (GCC)
configure arguments: --prefix=/app/tools/nginx-1.26.2/ --user=nginx --group=nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# .启动nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# /app/tools/nginx/sbin/nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# .检查进程
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# ps -ef | grep nginx
root 22441 1 0 01:56 ? 00:00:00 nginx: master process /app/tools/nginx/sbin/nginx
nginx 22442 22441 0 01:56 ? 00:00:00 nginx: worker process
root 22445 17207 0 01:57 pts/0 00:00:00 grep nginx
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]#
# 检查端口
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# ss -lntup | grep nginx
tcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=22442,fd=8),("nginx",pid=22441,fd=8))
[root@Kylin-V10-sp3 /app/tools/nginx-1.26.2]# # 查看防火墙
[root@Kylin-V10-sp3 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: inactive (dead) since Thu 2024-08-29 01:45:50 CST; 2 days agoDocs: man:firewalld(1)Main PID: 830 (code=exited, status=0/SUCCESS)8月 25 12:25:13 Kylin-V10-sp3 systemd[1]: Starting firewalld - dynamic firewall daemon...
8月 25 12:25:14 Kylin-V10-sp3 systemd[1]: Started firewalld - dynamic firewall daemon.
8月 29 01:45:49 Kylin-V10-sp3 systemd[1]: Stopping firewalld - dynamic firewall daemon...
8月 29 01:45:50 Kylin-V10-sp3 systemd[1]: firewalld.service: Succeeded.
8月 29 01:45:50 Kylin-V10-sp3 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@Kylin-V10-sp3 ~]#
# 浏览器访问 http://10.0.0.36:80
1.2 Ubuntu2204安装
[root@ubuntu2204 ~]#
[root@ubuntu2204 ~]# mkdir packages
[root@ubuntu2204 ~]# cd packages/
[root@ubuntu2204 ~/packages]# pwd
/root/packages
[root@ubuntu2204 ~/packages]#
[root@ubuntu2204 ~/packages]# rz[root@ubuntu2204 ~/packages]# rz
rz waiting to receive.
[root@ubuntu2204 ~/packages]# tar xf nginx-1.26.2.tar.gz
[root@ubuntu2204 ~/packages]#
[root@ubuntu2204 ~/packages]# ll
total 1320
drwxr-xr-x 3 root root 4096 Sep 3 11:28 ./
drwx------ 8 root root 4096 Sep 3 11:27 ../
-rw-r--r-- 1 root root 91622 Sep 3 09:41 bird.tar.gz
drwxr-xr-x 8 502 staff 4096 Aug 13 00:39 nginx-1.26.2/
-rw-r--r-- 1 root root 1244789 Sep 3 10:05 nginx-1.26.2.tar.gz
[root@ubuntu2204 ~/packages]# cd nginx-1.26.2/
[root@ubuntu2204 ~/packages/nginx-1.26.2]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
# 安装依赖
[root@ubuntu2204 ~/packages/nginx-1.26.2]# apt install -y libpcre3 libpcre3-dev libssl-dev zlib1g-dev
# 安装gcc
[root@ubuntu2204 ~/packages/nginx-1.26.2]# apt-get install build-essential -y[root@ubuntu2204 ~/packages/nginx-1.26.2]# gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.[root@ubuntu2204 ~/packages/nginx-1.26.2]# ./configure* --prefix=/app/tools/nginx-1.26.2/ --user=nginx --group=nginx[root@ubuntu2204 ~/packages/nginx-1.26.2]# echo $?
0
[root@ubuntu2204 ~/packages/nginx-1.26.2]# make
[root@ubuntu2204 ~/packages/nginx-1.26.2]# echo $?
0
[root@ubuntu2204 ~/packages/nginx-1.26.2]#[root@ubuntu2204 ~/packages/nginx-1.26.2]# make install
[root@ubuntu2204 ~/packages/nginx-1.26.2]# echo $?
0
[root@ubuntu2204 ~/packages/nginx-1.26.2]#[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# ln -s /app/tools/nginx-1.26.2/ /app/tools/nginx
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# id nginx
id: ‘nginx’: no such user
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# useradd -s /sbin/nologin -M nginx
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# id nginx
uid=1002(nginx) gid=1002(nginx) groups=1002(nginx)
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# ss -lntup
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=832,fd=13))
tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=832,fd=14))
tcp LISTEN 0 128 0.0.0.0:18326 0.0.0.0:* users:(("sshd",pid=918,fd=3))
tcp LISTEN 0 128 [::]:18326 [::]:* users:(("sshd",pid=918,fd=4))
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# /app/tools/nginx/sbin/nginx -V
nginx version: nginx/1.26.2
built by gcc 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
configure arguments: --prefix=/app/tools/nginx-1.26.2/ --user=nginx --group=nginx
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# /app/tools/nginx/sbin/nginx
[root@ubuntu2204 ~/packages/nginx-1.26.2]# [root@ubuntu2204 ~/packages/nginx-1.26.2]# ps -ef | grep nginx
root 23595 1 0 13:04 ? 00:00:00 nginx: master process /app/tools/nginx/sbin/nginx
nginx 23596 23595 0 13:04 ? 00:00:00 nginx: worker process
root 23599 8123 0 13:05 pts/0 00:00:00 grep --color=auto nginx
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# ss -lntup | grep nginx
tcp LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=23596,fd=6),("nginx",pid=23595,fd=6))
[root@ubuntu2204 ~/packages/nginx-1.26.2]#
[root@ubuntu2204 ~/packages/nginx-1.26.2]# ifconfig
Command 'ifconfig' not found, but can be installed with:
apt install net-tools
[root@ubuntu2204 ~/packages/nginx-1.26.2]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 00:0c:29:95:37:e0 brd ff:ff:ff:ff:ff:ffaltname enp2s1inet 10.0.0.37/24 brd 10.0.0.255 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe95:37e0/64 scope link valid_lft forever preferred_lft forever
[root@ubuntu2204 ~/packages/nginx-1.26.2]# # 查看防火墙
[root@ubuntu2204 ~]# systemctl status ufw
● ufw.service - Uncomplicated firewallLoaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enabled)Active: active (exited) since Wed 2024-08-28 08:22:59 CST; 6 days agoDocs: man:ufw(8)Process: 669 ExecStart=/lib/ufw/ufw-init start quiet (code=exited, status=0/SUCCESS)Main PID: 669 (code=exited, status=0/SUCCESS)CPU: 2msAug 28 08:22:58 ubuntu2204 systemd[1]: Starting Uncomplicated firewall...
Aug 28 08:22:59 ubuntu2204 systemd[1]: Finished Uncomplicated firewall.
[root@ubuntu2204 ~]#
[root@ubuntu2204 ~]# systemctl stop ufw
[root@ubuntu2204 ~]#
[root@ubuntu2204 ~]# systemctl status ufw
○ ufw.service - Uncomplicated firewallLoaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enabled)Active: inactive (dead) since Tue 2024-09-03 14:23:31 CST; 2s agoDocs: man:ufw(8)Process: 669 ExecStart=/lib/ufw/ufw-init start quiet (code=exited, status=0/SUCCESS)Process: 23807 ExecStop=/lib/ufw/ufw-init stop (code=exited, status=0/SUCCESS)Main PID: 669 (code=exited, status=0/SUCCESS)CPU: 3msAug 28 08:22:58 ubuntu2204 systemd[1]: Starting Uncomplicated firewall...
Aug 28 08:22:59 ubuntu2204 systemd[1]: Finished Uncomplicated firewall.
Sep 03 14:23:31 ubuntu2204 systemd[1]: Stopping Uncomplicated firewall...
Sep 03 14:23:31 ubuntu2204 ufw-init[23807]: Skip stopping firewall: ufw (not enabled)
Sep 03 14:23:31 ubuntu2204 systemd[1]: ufw.service: Deactivated successfully.
Sep 03 14:23:31 ubuntu2204 systemd[1]: Stopped Uncomplicated firewall.
[root@ubuntu2204 ~]# # 浏览器访问 http://10.0.0.37:80
2.部署代码
# Kylin和Ubt操作相同
# 解压bird.tar.gz 到 /app/tools/nginx/html/目录
[root@ubuntu2204 ~/packages]# tar xf bird.tar.gz -C /app/tools/nginx/html/
[root@ubuntu2204 ~/packages]#
# 检查 /app/tools/nginx/html/index.html文件
[root@ubuntu2204 ~/packages]# ll /app/tools/nginx/html/
total 156
drwxr-xr-x 3 root root 4096 Nov 16 2021 ./
drwxr-xr-x 11 root root 4096 Sep 3 13:04 ../
-rw-r--r-- 1 root root 15329 Aug 2 2014 2000.png
-rw-r--r-- 1 root root 51562 Aug 2 2014 21.js
-rw-r--r-- 1 root root 497 Sep 3 13:01 50x.html
-rw-r--r-- 1 root root 254 Aug 2 2014 icon.png
drwxr-xr-x 2 root root 4096 Aug 8 2014 img/
-rw-r--r-- 1 root root 3049 Aug 2 2014 index.html
-rw-r--r-- 1 root root 63008 Aug 2 2014 sound1.mp3
[root@ubuntu2204 ~/packages]#
# 刷新页面