0
点赞
收藏
分享

微信扫一扫

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

1.关闭防火墙

[root@localhost wzj]# systemctl stop firewalld
[root@localhost wzj]# sstenforce 0
bash: sstenforce: command not found...
[root@localhost wzj]# setenforce 0
2,挂mnt
[root@localhost wzj]# mount/dev/sr0/mnt
bash: mount/dev/sr0/mnt: No such file or directory
[root@localhost wzj]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
3.安装

dnf install nginx -y

4.启动

systemctl start nginx

5,修改协议

vim /etc/nginx/nginx.conf

在root前加#并且下一行添加

root /www:

6.新增www文件

mkdir /www

7.添加内容

echo www > /www/index.html

8.重启nginx协议

systemctl restart nginx

9.修改IP地址

nmcli c  modify ens160 ipv4.method manual ipv4.addresses 192.168.75.130/24 +ipv4.adresses 192.168.75.200/24 ipv4.gateway 192.168.75.2 ipv4.dns 114.114.114.114

10.激活

emcli connection up ens160

11.修改文件信息

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

server
listen 192.168.75.130:80;root /test/130;location /{index index.html;
server 
listen 192.168.75.200:80:root /text/200;location /{index index.html,

12创建文件130,200

mkdir /test/{130,200} -pv

13.分别在两个文件中添加内容

echo this 130 > /test/130/index.html

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

搜索域名查找内容

举报

相关推荐

0 条评论