Docker容器编译安装Nginx
Docker容器编译安装Nginx,最简单的Nginx配置。
创建容器&进入容器
- 宿主机2080映射容器的80端口
[root@localhost ~]# docker run -i -d -h centoscs --name centoscs --net docker-br0 --ip 172.127.0.201 -p 2080:80 -v /Tools:/Tools --privileged=true centos:7 /usr/sbin/init
[root@localhost ~]# docker exec -it centoscs /bin/bash
1、安装依赖包
[root@localhost /]# yum install gcc gcc-c++ make automake autoconf libtool pcre* zlib openssl openssl-devel
2、下载Nginx安装包(1.18版本)
[root@localhost /]# mkdir Tools
[root@localhost /]# cd Tools
[root@localhost Tools]# wget http://nginx.org/download/nginx-1.18.0.tar.gz
3、解压
[root@localhost Tools]# tar -zxvf nginx-1.18.0.tar.gz
4、进入解压后的目录
[root@localhost Tools]# cd nginx-1.18.0
5、编译安装
- --prefix 指定安装路径
[root@centoscs nginx-1.18.0]# ./configure --prefix=/usr/local/nginx
[root@centoscs nginx-1.18.0]# make && make install
6、最简单的代理配置
- 配置文件路径
/usr/local/conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
# proxy_pass http://localhost:8080; # 代理的服务地址
index index.html index.htm index.jsp;
root html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
7、Nginx服务管理
- 启动服务路径
/usr/local/nginx/sbin
[root@centoscs sbin]# ./nginx #启动
[root@centoscs sbin]# ./nginx -s reload # 重启
[root@centoscs sbin]# ./nginx -s stop # 停止
[root@centoscs sbin]# ./nginx -v # 查看版本
- 未代理任何服务
- 配置了代理tomcat服务
Docker容器编译安装Nginx的更多相关文章
- Docker容器编译安装Redis
Docker容器编译安装Redis 1.创建容器 -i 交互模式 -d 后端运行 -h 容器的hostname --name 容器名 --network 网卡 --ip IP地址 -p 端口映射 -- ...
- Centos7环境下Docker容器的安装与卸载
Docker是一个开源的引擎,可以轻松的为任何应用创建一个轻量级的.可移植的.自给自足的容器.开发者在笔记本上编译测试通过的容器可以批量地在生产环境中部署,包括VMs(虚拟机).bare metal. ...
- Docker Alpine Dockerfile 安装nginx,最小镜像
Docker Alpine Dockerfile 安装nginx,最小镜像 FROM alpine MAINTAINER will ## 将alpine-linux:apk的安装源改为国内镜像 RUN ...
- centos系统编译安装nginx+php环境另加独立mysql教程
以前看过的安装nginx+php环境都带了mysql数据库了,这个是因为很多站长都是nginx+php+mysql都在同一台服务器了,那么今天我们是单独处理了,一个是nginx+php环境,然后mys ...
- Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Mariadb 10.1.20 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 )
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...
- CentOS7 编译安装 Nginx (实测 笔记 Centos 7.0 + nginx 1.6.2)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- linux软件管理之------编译安装nginx服务器并手动编写自动化运行脚本
红帽系列的 linux软件管理分为三类:1. rpm 安装软件.2. yum 安装软件.3. 源码包编译安装.前面两种会在相关专题给出详细讲解.源码包的编译安装是非常关键的,我们知道linux的相关版 ...
- Mac Pro 编译安装 Nginx 1.8.1
#下载相关源码包,统一放到 /usr/local/src 目录下: http://nginx.org/download/nginx-1.8.1.tar.gz http://zlib.net/zlib- ...
- 【转】linux 编译安装nginx,配置自启动脚本
linux 编译安装nginx,配置自启动脚本 本文章来给各位同学介绍一篇关于linux 编译安装nginx,配置自启动脚本教程,希望有需要了解的朋友可一起来学习学习哦. 在公司的suse服务器装ng ...
随机推荐
- 初识react中高阶组件
高阶组件并不是一个组件,而是一个函数 这个函数返回值是一个组件,并且接受一个组件做为参数:并且返回一个新组件: function HighOC(WrapComponent){ //定义一个高阶组件 , ...
- Kubernetes 解决方案-图解
- 帝国cms发布文章对哪些数据表做了操作
帝国cms 发布一篇文章会影响哪些数据表 insert into phome_enewsfile_1(pubid,filename,filesize,adduser,path,filetime,cla ...
- 羽夏壳世界—— PE 结构(上)
羽夏壳世界之 PE 结构(上),介绍难度较低的基本 PE 相关结构体.
- NodeJs学习日报day6——路由模块
const express = require('express') const app = express() app.get('/user', function(req, resp) { resp ...
- Divide by Zero 2021 and Codeforces Round #714 (Div. 2) B. AND Sequences思维,位运算 难度1400
题目链接: Problem - B - Codeforces 题目 Example input 4 3 1 1 1 5 1 2 3 4 5 5 0 2 0 3 0 4 1 3 5 1 output 6 ...
- input清楚阴影 number属性
IOS,input出现阴影: input[type="text"],input[type="email"],input[type="search&qu ...
- Divan and bitwise operations
这是一道比较综合的数学题目,光是吧题目看懂就花了我好一会儿时间,先看看题目吧: 题目分析:对于m段给定连续段的或值,要求出n个数的序列子序列的异或值之和: 题解: 这道题,我们先不要把它当作一个数一个 ...
- Quantexa CDI(场景决策智能)Syneo平台介绍
Quantexa 大数据服务提供商, 使用实体解析, 关系分析和人工智能技术帮助客户进行数据处理和预防金融犯罪. 企业概览 2016年成立, 当前规模500人 服务特色是场景决策智能CDI(conte ...
- 通俗易懂的ArcGis开发快速入门
前言 本文主要介绍ArcGis的ArcEngine开发,学习时,我们需要放下心里障碍,那就是Gis开发只是普通的软件开发,并不需要专业的GIS知识,就是非常普通的,调用相关的C++开发的COM组件. ...