linux-Nginx-arm的编译安装步骤详解

一、安装编译工具

#centos7,
yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel openssl-devel cmakepcre-develnanowget gcc gcc-c++ ncurses-devel per redhat-rpm-config.noarch


yum -y install libxml2 libxml2-dev libxslt-devel gd-devel  perl-devel perl-ExtUtils-Embed  GeoIP GeoIP-devel GeoIP-data pcre-devel openssl openssl-devel

#如果是debian或者 ubuntu 则需要按
apt install build-essential  gcc -y;

apt-get install libpcre3 libpcre3-dev libssl-dev libxml2-dev libxslt1-dev libgd-dev  libgoogle-perftools-dev -y
apt-get install  libextutils-embed-perl -y
sudo apt-get install python-sqlitecachec python-urlgrabber python-libxml2 python-rpm  python-rpm  python-sqlite python-urlgrabber -y;
sudo apt-get install python-urlgrabber -y;
sudo apt-get install python-libxml2 -y;
sudo apt-get install python-rpm -y;
sudo apt-get install python-sqlite -y;
sudo apt-get install python-urlgrabber -y;

#-将下载好的压缩包传进来
# 同时下载headers-more-nginx-module。下载的版本是v0.36。(nginx增加headers-more-nginx-module模块,去除header中的server信息)
#--添加配置在http模块
more_clear_headers 'Server';
#---https://github.com/openresty/headers-more-nginx-module/releases/tag/v0.36


cd /opt
wget http://nginx.org/download/nginx-1.25.3.tar.gz
wget https://github.com/openresty/headers-more-nginx-module/archive/refs/tags/v0.36.tar.gz
 

二、编译安装


#解压文件
tar -zxf nginx-1.25.3.tar.gz

tar -zxvf v0.36.tar.gz

cd nginx-1.25.3

./configure --prefix=/etc/nginx \
    --sbin-path=/usr/sbin/nginx \
    --modules-path=/usr/lib/nginx/modules \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --pid-path=/var/run/nginx.pid \
    --lock-path=/var/run/nginx.lock \
    --http-client-body-temp-path=/var/cache/nginx/client_temp \
    --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
    --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
    --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
    --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
    --user=nginx \
    --group=nginx \
    --with-compat \
    --with-file-aio \
    --with-threads \
    --with-http_addition_module \
    --with-http_auth_request_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_mp4_module \
    --with-http_random_index_module \
    --with-http_realip_module \
    --with-http_secure_link_module \
    --with-http_slice_module \
    --with-http_ssl_module \
    --with-http_stub_status_module \
    --with-http_sub_module \
    --with-http_v2_module \
    --with-http_v3_module \
    --with-mail \
    --with-mail_ssl_module \
    --with-stream \
    --with-stream_realip_module \
    --with-stream_ssl_module \
    --with-stream_ssl_preread_module \
    --with-cc-opt='-I /usr/local/include' \
    --with-ld-opt='-L /usr/local/lib' \
    --add-module=/usr/local/headers-more-nginx-module-0.36

//解释
--prefix=/etc/nginx \
#安装路径
--user=nginx \
#指定用户名
--group=nginx \
#指定用户组
--with-http_stub_status_module
#启用此模块支持状态统计
//
#---返回的信息
  nginx path prefix: "/etc/nginx"
  nginx binary file: "/usr/sbin/nginx"
  nginx modules path: "/usr/lib/nginx/modules"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/cache/nginx/client_temp"
  nginx http proxy temporary files: "/var/cache/nginx/proxy_temp"
  nginx http fastcgi temporary files: "/var/cache/nginx/fastcgi_temp"
  nginx http uwsgi temporary files: "/var/cache/nginx/uwsgi_temp"
  nginx http scgi temporary files: "/var/cache/nginx/scgi_temp"

#-------------------------
#编译
make 
#安装 
make install -j4


cat >/lib/systemd/system/nginx.service<<EOF
 
#!/bin.bash
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/bin/kill -s HUP $MAINPID
ExecStop=/usr/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
 
EOF


systemctl daemon-reload 
systemctl start nginx

  • 38
    点赞
  • 31
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值