栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Web端配置

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Web端配置

目录

Httpd安装与基础配置

基于多ip的多虚拟主机配置

基于主机域名的多虚拟主机配置

基于端口号的多虚拟主机的配置


Httpd安装与基础配置

dnf list httpd

dnf -y install httpd

127.0.0.1

Systemctl status httpd

Systemctl start httpd  //临时打开,重启之后就不行了

Systemctl status httpd

Systemctl enable httpd  //开机自启

Tree/etc/www

cd/etc

ll

cd/

ll

tree/var/www

echo “welcome”>/var/www/html/index.html

getenforce

Setenforce 0 //关闭selinux

Systemctl stop firewalld //关闭防火墙

systemctl status firewalld   //查看防火墙状态

systemctl stop firewalld    //暂时关闭防火墙

基于多ip的多虚拟主机配置

systemctl start httpd

nmtui

198.168.100.11/24

198.168.100.12/24

198.168.100.13/24

198.168.100.2

198.168.100.2

设置完成后即可

nmcli connection up yexi

mkdir /var/www/html/ai

cd /var//www/html     

ll

mkdir ca iot

ll

echo “192.168.100.11/24”>ai/index.html

echo “192.168.100.12/24”>ca/index.html

echo “192.168.100.13/24”>iot/index.html

cat ai/index.html

cat ca/index.html

cat iot/index.html

cd /

vim /etc/httpd/conf/httpd.conf

set nu

132g

  //133行

        DocumentRoot /var/www/html/ai

        ServerName www.whit_ai.com

       

        AllowOverride None

        Require all granted

       

 

        DocumentRoot /var/www/html/ca

        ServerName www.whit_ca.com

       

        AllowOverride None

        Require all granted

       

 

        DocumentRoot /var/www/html/iot

        ServerName www.whit_iot.com

       

        AllowOverride None

        Require all granted

       

:wq   //:w 存盘 :q退出 :wq 存盘退出

Systemctl restart httpd

基于主机域名的多虚拟主机配置

Nmtui

移除后两个ip地址

nmcli connection up yexi

vim /etc/hosts

192.168.100.11 www.whit_ai.com www.whit_ca.com www.whit_iot.com

Ping -c 4 www.whit_ai.com

Echo “welcome to ai”>/var/www/html/ai/index.html

Cat /var/www/html/ai/index.html

Echo “welcome to ca”>/var/www/html/ca/index.html

Echo “welcome to iot”>/var/www/html/iot/index.html

Vim /etc//httpd/conf/httpd.conf

  //133行

        DocumentRoot /var/www/html/ai

        ServerName www.whit_ai.com

       

        AllowOverride None

        Require all granted

       

 

        DocumentRoot /var/www/html/ca

        ServerName www.whit_ca.com

       

        AllowOverride None

        Require all granted

       

 

        DocumentRoot /var/www/html/iot

        ServerName www.whit_iot.com

       

        AllowOverride None

        Require all granted

       

:wq   //:w 存盘 :q退出 :wq 存盘退出

Systemctl restart httpd

基于端口号的多虚拟主机的配置

Vim /etc/httpd/conf/httpd.conf

:set nu //45行

Listen 6001

Listen 6002

Listen 6003

  //133行

        DocumentRoot /var/www/html/ai

        ServerName www.whit_ai.com

       

        AllowOverride None

        Require all granted

       

 

        DocumentRoot /var/www/html/ca

        ServerName www.whit_ca.com

       

        AllowOverride None

        Require all granted

       

 

        DocumentRoot /var/www/html/iot

        ServerName www.whit_iot.com

       

        AllowOverride None

        Require all granted

       

:wq

vim /etc/hosts

删除192

:wq

Systemctl restart httpd

Journalctl -xe       //不重要的一句话

Semanage port -l |grep http

Semanage port -a -t http_port_t -p tcp 6001

Semanage port -a -t http_port_t -p tcp 6002

Semanage port -a -t http_port_t -p tcp 6003

Semanage port -l|grep http

Systemctl restart httpd

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/888050.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号