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. react中自定义antd主题与支持less(第二部)

    自定义主题 首先自定义主题需要修改antd,antd本身也是less写的之后编译成css的,所以当我们需要使用less. 1.yarn add react-app-rewire-less --dev ...

  2. js几种常见排序的实现

    1. 冒泡排序 定义: 比较相邻的前后二个数据,如果前面数据大于后面的数据,就将二个 数据交换. 这样对数组的第0个数据到N-1个数据进行一次遍历后,最大的一个数据就"沉"到数组第 ...

  3. fis学习

    http://fis.baidu.com/docs/beginning/getting-started.html#md5 还是喜欢时间戳?没问题,FIS也可以满足你的需求,点击这里

  4. python极简教程07:封装、多态和继承

    测试奇谭,BUG不见. 这一场主讲python的面向对象部分--封装.多态和继承. 目的:掌握Python面向对象的三个核心概念. 封装 01 什么是封装? 封装的目的是,保护隐私.通俗的讲:不想让别 ...

  5. k8s中kubeconfig的配置及使用

    1.概述 kubeconfig文件保存了k8s集群的集群.用户.命名空间.认证的信息.kubectl命令使用kubeconfig文件来获取集群的信息,然后和API server进行通讯. 注意:用于配 ...

  6. 多线程-线程间通信-多生产者多消费者问题(JDK1.5后Lock,Condition解决办法及开发中代码范例)

    1 package multithread4; 2 3 import java.util.concurrent.locks.Condition; 4 import java.util.concurre ...

  7. 浅谈kali : arpspoof工具原理

    Arpspoof工具 介绍 arpspoof是一个通过ARP协议伪造数据包实现中间人攻击的kali工具. 中间人攻击虽然古老,但仍处于受到黑客攻击的危险中,可能会严重导致危害服务器和用户.仍然有很多变 ...

  8. python12day

    昨日回顾 可迭代对象: 可以更新迭代的实实在在的值. 内部含有'__iter__'方法. str.tuple.dict.set.range 优点:操作方法多,灵活直观 缺点:占用内存. 迭代器: 可以 ...

  9. Core 3.1 MVC 抛异常“InvalidOperationException: No service for type 'Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory' has been registered.”

    .NET Core 的版本是 3.1遇到的问题是 Action 中 return View() 的时候报错 An unhandled exception occurred while processi ...

  10. python 定义函数关键字def 简单介绍

    一  在类中定义的def # python中def 是用来干什么的? # 可以定义函数,就是定义一个功能. class People(): def __init__(self): print(&quo ...