Linux:~ # cat /etc/os-release
NAME="SLES"
VERSION="12-SP3"
VERSION_ID="12.3"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp3"

编译前准备

创建nginx用户

Linux:~ # useradd -ms /sbin/nologin nginx
Linux:~ # groupadd nginx

下载nginx源码包

Linux:~ # wget -c http://nginx.org/download/nginx-1.16.0.tar.gz
Linux:~ # tar xf nginx-1.16.0.tar.gz -C /usr/local/

安装编译环境依赖

gcc环境

Linux:~ # zypper in gcc gcc-c++ make

安装pcre软件包(使 nginx 支持 http rewrite 模块)

Linux:~ # wget ftp://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
Linux:~ # tar xf pcre-8.44.tar.gz -C /usr/local/
  • 如果是Centos发行版,执行 yum install -y pcre pcre-devel

安装zlib

Linux:~ # zypper in libz1 zlib-devel
  • 如果是Centos发行版,执行 yum install -y zlib zlib-devel

安装gd

http_image_filter_module 需要gd库

Linux:~ # wget -c https://github.com/libgd/libgd/releases/download/gd-2.3.0/libgd-2.3.0.tar.gz
Linux:~ # tar xf libgd-2.3.0.tar.gz -C /usr/local/
Linux:~ # cd /usr/local/libgd-2.3.0/
Linux:/usr/local/libgd-2.3.0 # ./configure \
--bindir=/usr/sbin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--libdir=/usr/lib64 \
--mandir=/usr/share/man &&\
make && \
make install
  • 如果是Centos发行版,执行 yum install -y gd gd-devel

安装 openssl (使 nginx 支持 ssl

Linux:~ # zypper in openssl libopenssl-devel
  • 如果是Centos发行版,执行 yum install -y openssl openssl-devel

编译nginx

Linux:~ # cd /usr/local/nginx-1.16.0/
Linux:/usr/local/nginx-1.16.0 # ./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-pcre=/usr/local/pcre-8.44 \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-http_image_filter_module \
--with-http_slice_module \
--with-mail \
--with-threads \
--with-file-aio \
--with-stream \
--with-mail_ssl_module \
--with-stream_ssl_module && \
make && \
make install

配置nginx为systemctl管理

Linux:~ # cat > /usr/lib/systemd/system/nginx.service <<EOF
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target [Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
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
PrivateTmp=true [Install]
WantedBy=multi-user.target
EOF
Linux:~ # systemctl daemon-reload
Linux:~ # systemctl enable nginx --now
Linux:~ # ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
Linux:~ # nginx -v
nginx version: nginx/1.16.0

suse 12 编译部署 Nginx的更多相关文章

  1. suse 12 编译部署Keepalived + nginx 为 kube-apiserver 提供高可用

    文章目录 编译部署nginx 下载nginx源码包 编译nginx 配置nginx.conf 配置nginx为systemctl管理 分发nginx二进制文件和配置文件 启动kube-nginx服务 ...

  2. suse 12 二进制部署 Kubernetets 1.19.7 - 第13章 - 部署metrics-server插件

    文章目录 1.13.0.创建metrics-server证书和私钥 1.13.1.生成metrics-server证书和私钥 1.13.2.开启kube-apiserver聚合配置 1.13.3.分发 ...

  3. suse 12 二进制部署 Kubernetets 1.19.7 - 番外篇 - 增加node节点

    文章目录 0.前景提要 1.准备node节点环境 1.0.修改配置脚本参数 1.1.配置免密 1.2.添加hosts解析 1.3.修改主机名 1.4.更新PATH变量 1.5.安装依赖包 1.6.关闭 ...

  4. suse 12 二进制部署 Kubernetets 1.19.7 - 第01章 - 创建CA证书和kubectl集群管理命令

    文章目录 1.kubernetes集群部署 1.0.创建CA证书和秘钥 1.0.0.安装cfssl工具 1.0.1.创建根证书 1.0.2.创建证书签名请求文件 1.0.3.生成CA证书和秘钥 1.0 ...

  5. suse 12 二进制部署 Kubernetets 1.19.7 - 第02章 - 部署etcd集群

    文章目录 1.2.部署etcd集群 1.2.0.下载etcd二进制文件 1.2.1.创建etcd证书和私钥 1.2.2.生成etcd证书和私钥 1.2.3.配置etcd为systemctl管理 1.2 ...

  6. suse 12 二进制部署 Kubernetets 1.19.7 - 第03章 - 部署flannel插件

    文章目录 1.3.部署flannel网络 1.3.0.下载flannel二进制文件 1.3.1.创建flannel证书和私钥 1.3.2.生成flannel证书和私钥 1.3.3.将pod网段写入et ...

  7. suse 12 二进制部署 Kubernetets 1.19.7 - 第04章 - 部署docker服务

    文章目录 1.4.部署docker 1.4.0.下载docker二进制文件 1.4.1.配置docker镜像加速 1.4.2.配置docker为systemctl管理 1.4.3.启动docker服务 ...

  8. suse 12 二进制部署 Kubernetets 1.19.7 - 第05章 - 部署kube-nginx

    文章目录 1.5.部署kube-nginx 1.5.0.下载nginx二进制文件 1.5.1.编译部署nginx 1.5.2.配置nginx.conf 1.5.3.配置nginx为systemctl管 ...

  9. suse 12 二进制部署 Kubernetets 1.19.7 - 第06章 - 部署kube-apiserver组件

    文章目录 1.6.部署kube-apiserver 1.6.0.创建kubernetes证书和私钥 1.6.1.生成kubernetes证书和私钥 1.6.2.创建metrics-server证书和私 ...

随机推荐

  1. SSM实现支付宝支付

    学习支付宝支付 一.支付宝测试环境代码测试 1.下载电脑网站的官方demo: 下载地址:https://docs.open.alipay.com/270/106291/ 2.下载解压导入eclipse ...

  2. SYCOJ2140祝福短信

    题目-祝福短信 (shiyancang.cn) 1 #include<bits/stdc++.h> 2 using namespace std; 3 map<string,bool& ...

  3. elementui-日期选择器时间清空报错踩坑

    今天在项目中遇到了这个大坑 具体问题:在日期清空时会报错 解决方法:给日期绑定的值添加监听

  4. 获取app启动时间

    启动APP并收集消耗时间的命令: adb shell am  start -W -n package/activity 手动关闭谷歌浏览器APP(也可以使用命令关闭adb shell am force ...

  5. 【刷题-LeetCode】223. Rectangle Area

    Rectangle Area Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectang ...

  6. vscode控制台中文乱码

    原因 vscode中文控制台乱码原因是调用的cmd的显示. 所以问题实际上是cmd的显示中文乱码问题.当然还有其他方法仅仅修改vscode的显示,这里不在说明. cmd中国版本windows默认是93 ...

  7. 判断jquery类库是否加载,如未加载则加载。

    本人所有文章使用到的东西均在"渭南电脑维修网"网站中得以实现和应用,还请大家参考. 抄写别人网站的同时,N多不同的网站,势必有N多的css.javascript引用文件都会重复引用 ...

  8. gorm连接mysql和模型定义那些事

    1. gorm操作mysql: 1.1 安装gorm gorm官网: https://gorm.io/zh_CN/docs/connecting_to_the_database.html gorm的g ...

  9. cnpm安装教程

    安装cnpm,输入以下命令: sudo npm install -g cnpm --registry=https://registry.npm.taobao.org 输入cnpm -v ,检测是否正常 ...

  10. clickhouse-mysql数据同步

    clickhouse版本:22.1.2.2 1.Mysql引擎(不推荐) CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] EN ...