1.nginx.conf 配置文件引入子配置文件 include vhost-server/*.conf;  关键在 server_name  不同域名执行不同的根

user  root;
#user nobody;
worker_processes 1; error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
client_max_body_size 20m;
include mime.types;
default_type application/octet-stream; underscores_in_headers on;
#add_header X-Frame-Options SAMEORIGIN;
#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/dev_access.log; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; include vhost-server/*.conf;
}

  2. vhost-server 下子配置 a.conf    b.conf

a.conf

server {
listen 80;
listen 443 ssl;
server_name test.com;
#ssl on;
ssl_certificate cert/test/test.pem;
ssl_certificate_key cert/test/test.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
error_log logs/sitxqy_error.log;
access_log logs/sitxqy_access.log; autoindex on; # 显示目录
autoindex_exact_size on; # 显示文件大小
autoindex_localtime on; # 显示文件时间 root html/test/;
index index.html; client_max_body_size 20m; location /api/ {
proxy_pass http://localhost:88/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} # location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|less|map|eot|svg|ttf|woff|woff2|cab|scss|otf|exe|pdf|doc|xlsx)$ {
# root html/xqc-h5/cloudSign;
# index index.html;
# } location / {
try_files $uri $uri/ /index.html;
} location /a {
try_files $uri $uri/ /a/index.html;
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
index index.html;
}
}

  b.conf

server {
listen 80;
listen 443 ssl;
server_name testa.com;
#ssl on;
ssl_certificate cert/testa.pem;
ssl_certificate_key cert/testa.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
error_log logs/sitxqy_error.log;
access_log logs/sitxqy_access.log; autoindex on; # 显示目录
autoindex_exact_size on; # 显示文件大小
autoindex_localtime on; # 显示文件时间 root html/cloudSignOpen;
index index.html; client_max_body_size 20m; location /api/ {
proxy_pass http://localhost:88/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} location / {
try_files $uri $uri/ /index.html;
} location /a {
try_files $uri $uri/ /a/index.html;
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
index index.html;
}
}

  

nginx 多域名指向多个根目录配置,设置自定义请求头 proxy_set_header,ssl 证书安装配置的更多相关文章

  1. centOS7 apache ssl证书安装配置

    背景说明:服务器是centOS7.4 七牛申请的免费ssl证书 默认apache是没有安装SSL模块的,所以需要安装,接着使用命令: yum install -y mod_ssl apache目录 / ...

  2. nginx ssl证书安装配置

    原理图: - 客户端生成一个随机数 random-client,传到服务器端(Say Hello) - 服务器端生成一个随机数 random-server,和着公钥,一起回馈给客户端(I got it ...

  3. Tomcat SSL证书安装配置

    [From Internet] 首先找到安装Tomcat 目录下该文件“Server.xml”,一般默认路径都是在Conf 文件夹中.然后用文本编辑器打开该文件,接着找到 <Connector ...

  4. 【转】七牛免费SSL证书,配置自定义域名CDN加速

    原文链接:https://excaliburhan.com/post/use-qiniu-ssl-and-cdn.html 申请七牛SSL证书 其实,七牛在很早之前就支持CDN使用https,但是他要 ...

  5. [python][nginx][https] Nginx 服务器 SSL 证书安装部署

    目录 前言 1 申请证书 2 Nginx 服务器 SSL 证书安装部署 2.1.准备 Nginx 环境 2.2 证书部署 2.3 Nginx 配置 3 最后 参考链接 前言 博主博客中的图片,使用的是 ...

  6. centos tomcat/resin安装配置 卸载系统自带的java tomcat安装配置 安装JDK resin安装配置 第二十八节课

    centos  tomcat/resin安装配置  卸载系统自带的java  tomcat安装配置  安装JDK   resin安装配置    第二十八节课 tomcat和java都不需要编译 tom ...

  7. 【转】服务器证书安装配置指南(Weblogic)

    服务器证书安装配置指南(Weblogic) 详情请点击: http://verisign.itrus.com.cn/html/fuwuyuzhichi/fuwuqizhengshuanzhuangpe ...

  8. 1.App爬取相关库的安装(安装Charles及手机端证书安装配置)

    一.官网下载Charles安装包: https://www.charlesproxy.com/download1.下载对应版本 我这里下载的是 win 64 bit (下载完解压,双击打开charle ...

  9. nginx二级域名指向不同文件项目配置

    需要使用泛域名解析, 并且加上空的判断,以保证没有二级域名的也可以访问 核心配置 server_name ~^(?<subdomain>.+)\.caipudq\.cn$;if ( $su ...

随机推荐

  1. vue 学习笔记(二)

    最近公司赶项目,一直也没时间看 vue,之前看下的都快忘得差不多了.哈哈哈,来一起回顾一下vue 学习笔记(一)后,继续向下看嘛. #表单输入绑定 基础用法 v-model 会忽略所有表单元素的 va ...

  2. 论文阅读-attention-is-all-you-need

    1结构介绍 是一个seq2seq的任务模型,将输入的时间序列转化为输出的时间序列. 有encoder和decoder两个模块,分别用于编码和解码,结合时是将编码的最后一个输出 当做 解码的第一个模块的 ...

  3. APP测试常见点

    1. 生成APK文件在真机上可以安装和卸载(安装卸载测试) 2. 第三方手机助手上面可以安装和卸载(安装卸载测试) 3. 启动APP 4. 验证数字签名.升级后可以正常使用.在线跨版本升级(在线升级测 ...

  4. Redis缓存之自定义CacheManager

    测试缓存:原理:CacheManager===Cache 缓存组件来实际给缓存中存储数据1,引入redis的starter,容器中保存的是RedisCacheManager2,RedisCacheMa ...

  5. [数据结构] 2.7 Heap 堆

    * 注: 本文/本系列谢绝转载,如有转载,本人有权利追究相应责任. 1.堆是什么? (如图所示是一个小堆) 1)堆是一颗完全二叉树,它的最后一层不是满的,其他每一层都是满的,最后一层从左到右也没有空隙 ...

  6. python-Excel读取-合并单元格读取

    python-Excel读取-合并单元格读取(后续会补充python-Excel写入的部分) 1. python读取Excel单元格 代码包含读取Excel中数据,以及出现横向合并单元格,以及竖向合并 ...

  7. 本地计算机上的 postgresql 服务启动后停止解决方法

    在启动 postgresql 服务是遇到这种情况: 解决方法: 打开计算机管理====>查看应用程序日志信息,可以看出,由于日志配置错误的问题. 找到 postgresql.conf 文件,做如 ...

  8. KiB 、十进制单位转换 、二进制单位转换

    KiB是kilo binary byte的缩写,指的是千位二进制字节 KB是kilobyte的缩写,指的是千字节   二进制标准命名   十进制国际单位制SI标准: 1 KB= 1,000 Byte ...

  9. 用html和css制作奥运五环

    <html><head><meta charset="utf-8"> <style>.circle1,.circle2,.circl ...

  10. jieba库与词云的使用——以孙子兵法为例

    1.打开cmd安装jieba库和 matplotlib. 2.打开python,输入代码.代码如下: from wordcloud import WordCloud import matplotlib ...