suse 12 编译部署 Nginx

简介: suse 12 编译部署 Nginx
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


目录
相关文章
|
21天前
|
应用服务中间件 Linux 网络安全
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
15 0
|
3月前
|
Kubernetes 应用服务中间件 nginx
百度搜索:蓝易云【使用Kubernetes部署Nginx应用教程】
现在,你已经成功在Kubernetes集群上部署了Nginx应用。通过访问Service的外部IP地址,你可以访问Nginx服务。
42 4
|
28天前
|
前端开发 应用服务中间件 nginx
Nginx配置详解Docker部署Nginx使用Nginx部署vue前端项目
Nginx配置详解Docker部署Nginx使用Nginx部署vue前端项目
110 0
|
5天前
|
JavaScript 前端开发 应用服务中间件
angular引入包、路由权限配置、打包问题与nginx配置问题(简单部署)
angular引入包、路由权限配置、打包问题与nginx配置问题(简单部署)
12 0
|
1天前
|
运维 Serverless 应用服务中间件
Serverless 应用引擎产品使用之在阿里云Serverless中函数计算FC nginx 部署上去之后放置静态页面如何解决
阿里云Serverless 应用引擎(SAE)提供了完整的微服务应用生命周期管理能力,包括应用部署、服务治理、开发运维、资源管理等功能,并通过扩展功能支持多环境管理、API Gateway、事件驱动等高级应用场景,帮助企业快速构建、部署、运维和扩展微服务架构,实现Serverless化的应用部署与运维模式。以下是对SAE产品使用合集的概述,包括应用管理、服务治理、开发运维、资源管理等方面。
23 0
|
13天前
|
应用服务中间件 Linux 开发工具
如何在阿里云服务器快速搭建部署Nginx环境
以下是内容的摘要: 本文档主要介绍了在阿里云上购买和配置服务器的步骤,包括注册阿里云账号、实名认证、选择和购买云服务器、配置安全组、使用Xshell和Xftp进行远程连接和文件传输,以及安装和配置Nginx服务器的过程。在完成这些步骤后,你将能够在服务器上部署和运行自己的网站或应用。
|
28天前
|
应用服务中间件 nginx Windows
windows下Nginx+RTMP部署
windows下Nginx+RTMP部署
21 0
|
2月前
|
应用服务中间件 Linux nginx
web后端-linux-nginx-1.18操作命令和部署
web后端-linux-nginx-1.18操作命令和部署
|
29天前
|
运维 前端开发 应用服务中间件
LNMP详解(八)——Nginx动静分离实战配置
LNMP详解(八)——Nginx动静分离实战配置
29 0
|
5天前
|
前端开发 JavaScript 应用服务中间件
前端vue2、vue3去掉url路由“ # ”号——nginx配置(二)
前端vue2、vue3去掉url路由“ # ”号——nginx配置
29 0