http——配置nginx服务通过ip访问多网站

关防火墙

systemctl stop firewalld

setenforce 0

安装挂载web

mount /dev/sr0 /mnt

dnf install nginx -y

启动web

systemctl start nginx

nmcli配置网卡

nmcli connection modify ens160 ipv4.method manual ipv4.addresses 192.168.182.100/24 +ipv4.addresses 192.168.182.200/24 ipv4.gateway 192.168.182.2 ipv4.dns 8.8.8.8

激活配置

nmcli connection up ens160

xshell更新连接ip后创建子配置文件并定义多个server模块

vim /etc/nginx/conf.d/test_ip.conf

创建对应目录文件

mkdir /test/{100,200} -pv

mkdir: created directory '/test'

mkdir: created directory '/test/100'

mkdir: created directory '/test/200'

echo test 100 > /test/100/index.html

echo test 200 > /test/200/index.html

重启服务

systemctl restart nginx

curl测试本地

测试网页

相关推荐
tan180°14 分钟前
Boost搜索引擎 查找并去重(3)
linux·c++·后端·搜索引擎
yongui4783430 分钟前
CentOS系统如何查看当前内存容量
linux·运维·centos
✎﹏赤子·墨筱晗♪33 分钟前
从反向代理到负载均衡:Nginx + Tomcat 构建高可用Web服务架构
nginx·tomcat·负载均衡
叶绪25835 分钟前
Nginx 反向代理 + Tomcat 集群:负载均衡配置步骤与核心原理
nginx·tomcat·负载均衡
xzq_java36 分钟前
CentOS操作系统虚拟机安装以及连接工具下载和远程连接工具远程连接
linux·运维·centos
Sweety丶╮7941 小时前
【Ansible】实施 Ansible Playbook知识点
服务器·云原生·ansible
逐梦吧!旅行者2 小时前
Linux之环境变量(内容由浅入深,层层递进)
linux·运维
IOT-Power2 小时前
树莓派 Ubuntu 24.04 开机换源总结
linux·数据库·ubuntu
weixin_468466852 小时前
树莓派32位与64位系统安装teamviewer远程软件
linux·单片机·自动化·树莓派·远程控制·vnc·teamviewer
挨踢攻城2 小时前
Linux 应急响应实操 Checklist
linux·运维·linux命令·rhce·rhca·厦门微思网络·linux 应急响应