马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
1.关闭防火墙- [root@localhost ~]# systemctl stop firewalld #关闭防火墙
- [root@localhost ~]# setenforce 0
复制代码 2.下载nginx包- [root@localhost ~]# mount /dev/sr0 /mnt #挂载目录
- [root@localhost ~]# yum install nginx -y #下载nginx包
复制代码 3.增长多条端口- [root@localhost ~]# nmcli connection modify ens160 ipv4.method manual ipv4.addresses 192.168.92.10/24 ipv4.gateway 192.168.88.2 ipv4.dns 192.168.88.2 +ipv4.addresses 192.168.88.20/24 +ipv4.addresses 192.168.88.30/24 #当前主机添加多地址
复制代码 4.期货网卡- [root@localhost ~]# nmcli connection up ens160 #激活网卡
复制代码 5.自界说nginx设置文件- [root@localhost ~]# vim /etc/nginx/conf.d/test_ip.conf #自定义nginx配置文件
- server {
- listen 192.168.88.10:80;
- root /test/10;
- location / {
- index index.html;
- }
- }
- server {
- listen 192.168.88.20:80;
- root /test/20;
- location / {
- index index.html;
- }
- }
- server {
- listen 192.168.88.30:80;
- root /test/30;
- location / {
- index index.html;
- }
- }
复制代码 6.- [root@localhost ~]# mkdir /test/{10,20,30} -pv
- mkdir: created directory '/test'
- mkdir: created directory '/test/10'
- mkdir: created directory '/test/20'
- mkdir: created directory '/test/30'
- [root@localhost ~]# echo this is 250 > /test/10/index.html
- [root@localhost ~]# echo this is 250 > /test/20/index.html
- [root@localhost ~]# echo this is 250 > /test/30/index.html
复制代码
|