多ip访问网站

多ip访问网站

安装nginx

[root@localhost ~]# dnf install nginx -y

关闭防火墙,sulinux

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

添加多IP(这里使用图形化模式)

[root@localhost ~]# nmtui
[root@localhost ~]# nmcli connection up ens160




撰写配置文件

[root@localhost ~]# vim /etc/nginx/conf.d/test_ip.conf
server {
        listen 192.168.36.100:80;
      # server_name
        root /test/100;
        location / {
                index index.html;
        }
}
server{
        listen 192.168.36.200:80;
        #server_name
        root /test/200;
        location / {
                index index.html;
        }
}

创建存放ip显示内容的目录

[root@localhost ~]# mkdir /test/{100,200} -pv

像两个ip网页写入内容

[root@localhost ~]# echo this is 1 > /test/100/index.html
[root@localhost ~]# echo this is 2 > /test/200/index.html

重启nginx服务

[root@localhost ~]# systemctl restart nginx

测试

[root@localhost ~]# curl 192.168.36.100
this is 1
[root@localhost ~]# curl 192.168.36.200
this is 2


相关推荐
Java Fans1 小时前
微信小程序——访问服务器媒体文件的实现步骤
服务器·微信小程序·小程序
yourkin6662 小时前
HTTPS(下)
服务器·网络协议·https
KingDol_MIni2 小时前
Spring Boot 集成 T-io 实现客户端服务器通信
java·服务器·spring boot
元气满满的热码式2 小时前
logstash中的input插件(http插件,graphite插件)
网络·网络协议·http·elasticsearch·云原生
神一样的老师3 小时前
超越云计算:计算连续体中的无服务器函数
服务器
ITPUB-微风3 小时前
美团MTSQL特性解析:技术深度与应用广度的完美结合
java·服务器·开发语言
@#---4 小时前
删除驱动精灵的详细过程
运维·服务器
boy快快长大4 小时前
【Elasticsearch】同一台服务器部署集群
服务器·elasticsearch·jenkins
豪宇刘5 小时前
从三个维度了解 RPC(Remote Procedure Call,远程过程调用)
网络·网络协议·rpc
放氮气的蜗牛5 小时前
Linux命令终极指南:从入门到精通掌握150+核心指令
linux·运维·服务器