zoukankan      html  css  js  c++  java
  • 多业务Nginx解决方式

    rpm -ql nginx 查看安装内容

    解决问题:一套nginx服务多个业务,方便维护nginx服务目的。

    虚拟主机配置方式:多IP 、多端口、多域名

    多IP实现:

    在单网卡添加ip别名

    ip a add 111.111.111.111/24dev eth0

    nginx 配置 /etc/nginx/conf.d 中cp default.conf nginserver1.comf

    default.conf 配server.listen 如111.111.111.110:80  与location root 。

    nginserver1.conf 配server.listen 如111.111.111.111:80  与location root 。

    配置完成后有检查下配置文件的语法可用性:nginx -tc /etc/nginx/nginx.conf 之后重启即可。

    ps:location root是访问的资源路径

    多端口实现:

    nginx 配置 /etc/nginx/conf.d  基于上述配置文件修改如下:

    default.conf 配server.listen 如 80  与location root 。

    nginserver1.conf 配server.listen 如 81 与location root 。重启即可。

    ps:  ss -luntp  看80 与 81使用情况

    多域名

    hosts 域名配置好后 如hostname1 hostname2两个域名, 修改下述配置

    default.conf 配server.server_name 如 hostname1 ,listen 80.

    nginserver1.conf 配server.server_name  如hostname2 , listen 80。重启即可。

    nhz94259@163.com
  • 相关阅读:
    网络通信
    jvm调优
    rokectMq
    mybatis属性类
    spring cloud feign
    spring cloud hystrix
    spring cloud ribbon
    mybatis(二)创建代理类执行sql
    内存操作函数
    堆空间的开辟与使用
  • 原文地址:https://www.cnblogs.com/nhz-M/p/9945454.html
Copyright © 2011-2022 走看看