前言

因为openstack使用的是apache,所以不能共享80端口,但创建的许多云主机,虽然可以通过rinetd进行跳转,但有时需要直接访问80端口,所以这里我们选择包含了nginx的openrety。

1.1. 安装openresty

1.向centos系统中添加openresty仓库

#yum install yum-utils

#yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

  

2.安装软件包

#yum install openresty

  

3.安装命令行工具

#yum install openresty-resty

  

1.2. 配置openresty

1.进入nginx目录

#cd /usr/local/openresty/nginx/conf/

  

2.编辑nginx配置文件

#vi nginx.conf

user  root;

worker_processes  12;

error_log  logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid; events {
worker_connections 10240;
} http {
include mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main; sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65; #gzip on;
include conf.d/*; server {
listen 80;
#
server_name 域名;
#指定日志路径
access_log logs/access.log main;
error_log logs/error.log; #
location / {
proxy_pass http://172.17.17.113;
}
}
}

  

3.在当前目录下创建conf.d文件夹

#mkdir /usr/local/openresty/nginx/conf/conf.d

#cd conf.d

  

4.创建要被读取的文件,目前定义为每台机器创建一台,这里定义添加一台aa机器,则创建aa.conf。

#vi aa.conf

server {
listen 80;
#绑定https
include /usr/local/openresty/nginx/https/https.conf;
#绑定域名
server_name 域名;
#指定日志路径
access_log logs/ope.access.log main;
error_log logs/ope.error.log; #指定通过域名跳转端口
location / { proxy_pass http://172.17.17.136:8081; } }

  

1.3. 使用openresty

1.检测nginx是否配置正确

#openresty -t

nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test is successful

  

2.重载openresty

#openresty -s reload

  

3.验证

在浏览器上输入绑定的域名即可直接访问80或者所需端口。

云计算---openstack实例共享80、443端口的更多相关文章

  1. 没有部署ingress pod的woker节点telnet slb的80 443端口不通

    一,问题描述 没有部署ingress pod的woker节点telnet slb的80 443端口不通 二,解决办法 方法一:改用svc地址调用 方法二:让每台woker节点都部署ingress po ...

  2. nginx反向代理 强制https请求 + 非root用户起80,443端口

    1. #强制使用https跳转 return 301 https://$server_name$request_uri;rewrite ^(.*)$ https://${server_name}$1 ...

  3. frps服务端与nginx可共用443端口

    转载自: https://www.ioiox.com/archives/78.html frps服务器上的nginx frps.ini配置 由于nginx占用80/443端口,frps.ini中的 v ...

  4. apache和IIS共享80端口问题

    使用apache代理功能和IIS共享80端口的解决办法. 第一步:把iis所发布的网站默认端口由80改为8080: 第二步:修改apache的httpd.conf配置文件.  首先,要让apache支 ...

  5. IIS Tomcat共享80端口

    为什么有这种需求, 原因是这样的, 公司有一个Java的web项目,在另一台服务器A上,最近老板一时兴起,想把他合并到这台稳定点的服务器B上,服务器B上使用IIS来寄宿asp.net 网站, 怎么办呢 ...

  6. docker上部署nginx容器80端口自动转443端口

    拉去nginx镜像 # docker pull nginx 运行nginx容器config用于拷贝nginx配置文件 # docker run --name nginxconfig -d docker ...

  7. apache和IIS共享80端口解决办法

    第一步:把iis所发布的网站默认端口由80改为8080:第二步:修改apache的httpd.conf配置文件. 首先,要让apache支持转发也就是做iis的代理那么就要先启 用apache的代理模 ...

  8. [转帖]nginx 80端口重定向 转发到443端口

    nginx 80端口重定向到443端口 2017年05月16日 13:53:58 幸福丶如此 阅读数 33387   版权声明:本文为博主原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文 ...

  9. 阿里云服务器win2003下iis整合tomcat共享80端口

    阿里云服务器win2003下iis整合tomcat共享80端口 很多机器都用tomcat跟IIS部署不同网站.最近买了阿里云的服务器.于是也想玩一下.网上百度了很多方法.但是都有缺陷说的不是很清楚.通 ...

随机推荐

  1. shiro框架的使用实例

    文档路径(包括数据库结构):https://pan.baidu.com/s/1eRP14AI

  2. ELF哈希技术

    ELFhash详情见点击打开链接 代码如下: unsigned int ELFhash(char *str) { unsigned int hash=0; unsigned int x=0; whil ...

  3. FineUIPro控件库深度解析

    FineUIPro控件库 FineUIPro是一套基于jQuery的专业ASP.NET控件库,始于2008年的开源版FineUI控件库. 当年为了提升项目的开发效率,降低代码复杂度,减少对CSS和Ja ...

  4. 规模数据导入高效方式︱将数据快速读入R—readr和readxl包

    本文由雪晴数据网负责翻译整理,原文请参考New packages for reading data into R - fast作者David Smith.转载请注明原文链接http://www.xue ...

  5. ADS1.2中RO base与RW base

    ARM映像文件 ARM中的各种源文件(包括汇编文件,C语言程序及C++程序等)经过ARM编译器编译后生成ELF(Executable and linking format)格式的目标文件.这些目标文件 ...

  6. 错误代码: 1052 Column 'stu_id' in field list is ambiguous

    1.错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:select stu_id, (SELECT stu_name FROM t ...

  7. Caused by: org.h2.jdbc.JdbcSQLException: Table "T_STUDENT_INFO" not found; SQL statement

    1.错误描述 org.hibernate.exception.SQLGrammarException: error executing work at org.hibernate.exception. ...

  8. AVStream ddk 翻译

    1.       AVStream概览 AVStream是一款微软提供的多媒体类驱动程序,它既支持单独的视频流媒体,也支持音频视频集成的流媒体.微软把AVStream作为操作系统的一部分,在驱动程序k ...

  9. cookie的设置和获取

    // 创建cookiefunction setCookie(name, value, expires, path, domain, secure) { var cookieText = encodeU ...

  10. hdu5863 cjj's string game

    矩阵快速幂 #include<bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MOD = ...