编译安装nginx并部署代码

news/2024/11/15 20:35:41/文章来源:https://www.cnblogs.com/daofaziran/p/18394030

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]# 
# 刷新页面

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/791642.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

编译安装ngx并部署代码

1.编译安装nginx 编译安装:三部曲配置(configure),编译(make),安装(make install) 配置(configure) 指定安装目录 编译(make) 源代码---编译工具-->可执行文件(命令) 安装(make install) 根据第1步骤的配置,创建目录,复制文件,复制目录.1.1 Kylin_v10_sp3安装 [root@Kylin-V…

美团一面:Spring Cloud 远程调用为啥要采用 HTTP,而不是 RPC?

作者:简简单单神经蛙 来源:blog.csdn.net/m0_61878423/article/details/124607067 关于SpringCloud远程调用采用HTTP而非RPC。 1、首先SpringCloud开启Web服务依赖于内部封装的Tomcat容器,而今信息飞速发展,适应大流量的微服务,采用Tomcat处理HTTP请求,开发者编写Json作…

zabbix“专家坐诊”第254期问答

问题一 Q:老师,我重启zabbix-server服务,恢复正常了,然后过了一两分钟再刷新,有报这个错了。我看zabbix-server日志里没什么有用的信息。A:selinux 关闭一下 Q:是关闭状态 A:看看server 自监控有没有 报错提示,看看有没有什么指标是超过触发器的 Q:没有报错,看起来内…

解决 Exchange 发到邮件组报错 550 5.1.1 User unknown (in reply to RCPT TO command)

版本 2010 只需要关闭:要求所有发件人通过身份验证 位置: Exchange 管理控制台收件人配置通讯组XXX组属性邮件流设置邮件传递设置[√]要求所有发件人通过身份验证取消勾选,再点确定即可参考资料: https://portal.thobson.com/knowledgebase/427/550-511-User-unknown--How-…

Exchange 2016部署实施案例篇-03.Exchange部署篇(中)

上一章《Exchange 2016部署实施案例篇-03.Exchange部署篇(上)》我们对部署Exchange Server 2016的先决条件做了简单的讲解,接下来我们进入先决条件准备工作。 先简单说下环境:服务器名称IP地址系统作用ADSrv01 192.168.1.10 Win2016 GC(已部署完成)ADSrv02 192.168.1.20 Wi…

SpringBoot——关于banner

springboot启动后,控制台会打印一个图案出来,这个图案就叫banner,如果不配置的话打印的是springboot默认的banner 几个可以的生成banner的网址: https://bootschool.net/ascii https://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type Something

省钱的开源项目「GitHub 热点速览」W3

本期,我从上周的热门开源项目中挑选了 5 个既省钱又省事,还好玩的开源项目。 首先,推荐的是省钱的电动汽车智能充电管理平台 evcc,它可以根据分时电价智能安排电动车充电时间,从而降低电费,如果你家还有太阳能充电和储能设备,evcc 更能最大限度地利用电能,让你的充电成…

Go语言中的交互式CLI开发:survey库简介

在构建命令行工具时,良好的用户交互体验至关重要。尤其是在需要与用户进行复杂输入的场景下,传统的命令行参数和标志可能显得笨拙。github.com/AlecAivazis/survey/v2 是一个为 Go 语言设计的库,专门用于构建交互式的命令行界面。它提供了多种用户输入方式,让你的 CLI 工具…

专业级语义搜索优化:利用 Cohere AI、BGE Re-Ranker 及 Jina Reranker 实现精准结果重排

专业级语义搜索优化:利用 Cohere AI、BGE Re-Ranker 及 Jina Reranker 实现精准结果重排专业级语义搜索优化:利用 Cohere AI、BGE Re-Ranker 及 Jina Reranker 实现精准结果重排 1. 简介 1.1 RAG 在说重排工具之前,我们要先了解一下 RAG。 检索增强生成(RAG)是一种新兴的 …

Exchange 2016部署实施案例篇-02.活动目录部署篇

其实在写这篇博文之前纠结了好久,到底是该写部署1台AD演示下,还是部署2台活动目录那,比较这个专家还是以Exchang为主,但思来想去最终决定还是部署一主一辅吧,毕竟部署主与辅助还是稍微在步骤上有些不同的,废话不多说,接下来我们开始我们今天的话题,活动目录部署,请大家…

红米k70 pro澎湃os系统安装谷歌商店

第一步第二步 第三步 效果图

PA1-碎碎念

part 1 8.27 方便管理,主要是想熟悉下git的操作 先创建并且切换到一个新的分支: git commit --allow-empty -am "before starting PA1" git checkout -b PA1其中--allow-empty表示允许提交一个空的提交,git默认是不能提交一个空的提交信息,如果当前的文档没有什么…