Ubuntu18.04内网环境安装nginx

依赖环境包:openssl-1.1.1t.tar.gz
下载地址:https://www.openssl.org/

依赖环境包:pcre2-10.42.tar.gz
下载地址:https://github.com/PhilipHazel/pcre2/releases​​​​​

依赖环境包:zlib-1.2.13.tar.gz
下载地址:zlib Home Site​​​​​​

对!补充一点!如果没有gcc等环境依赖,又不通外网,自求多福!(依赖是真多,找的头皮发麻)

nginx版本:nginx-1.23.3.tar.gz

#解压
tar xf openssl-1.1.1t.tar.gz
tar xf pcre2-10.42.tar.gz
tar xf zlib-1.2.13.tar.gz

tar xf nginx-1.23.3.tar.gz

#编译安装 openssl SLL需要
cd openssl-1.1.1t
./config -Wl,-rpath=/usr/lib64 --prefix=/usr/local/openssl --openssldir=/usr/local/openssl --libdir=/usr/lib64
make
make install
#编译安装 zlib Gzip模块需要
cd zlib-1.2.13
./configure 
make
make install
#编译安装 pcre
cd pcre2-10.42
./configure --prefix=/usr/local/pcre2-10.42
make
make install

#编译安装nginx
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf --http-log-path=/usr/local/nginx/log/access.log --error-log-path=/usr/local/nginx/log/error.log --lock-path=/usr/local/nginx/nginx.lock --pid-path=/usr/local/nginx/nginx.pid --modules-path=/usr/local/nginx/modules --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-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module

make

make install

#启动nginx
/usr/local/nginx/sbin/nignx

#设置systemctl控制nginx
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target

#刷新systemctl
systemctl daemon-reload

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值