• lamp-----5 apache虚拟主机实现,发布多个独立站点


    1.。。基于ip

    vi /etc/httpd/conf/httpd.conf

    <VirtualHost 192.168.1.142:80>
    ServerName 192.168.1.142:80
    DocumentRoot /web/upload

    <Directory "/web/upload">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog /var/log/httpd/142error.log
    CustomLog /var/log/httpd/142access.log combined
    </VirtualHost>

    <VirtualHost 192.168.1.143:80>
    ServerName 192.168.1.143:80
    DocumentRoot /var/www/html/upload

    <Directory "/var/www/html/upload">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog /var/log/httpd/143error.log
    CustomLog /var/log/httpd/143access.log combined
    </VirtualHost>

    systemctl restart httpd.service

    测试

    2.。。基于端口

    vi /etc/httpd/conf/httpd.conf

    <VirtualHost 192.168.1.142:80>
    ServerName 192.168.1.142:80
    DocumentRoot /web/upload

    <Directory "/web/upload">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog /var/log/httpd/142error.log
    CustomLog /var/log/httpd/142access.log combined
    </VirtualHost>

    <VirtualHost 192.168.1.142:8091>
    ServerName 192.168.1.142:8091
    DocumentRoot /var/www/html/upload

    <Directory "/var/www/html/upload">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog /var/log/httpd/143error.log
    CustomLog /var/log/httpd/143access.log combined
    </VirtualHost>

    测试

    完成。。

    3.。。。基于域名

    vi /etc/httpd/conf/httpd.conf

    NameVirtualHost *:80

    <VirtualHost 192.168.1.142:80>
    ServerName www.han.com
    DocumentRoot /web/upload

    <Directory "/web/upload">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog /var/log/httpd/142error.log
    CustomLog /var/log/httpd/142access.log combined
    </VirtualHost>

    <VirtualHost 192.168.1.142:80>
    ServerName www.lei.com
    DocumentRoot /var/www/html/upload

    <Directory "/var/www/html/upload">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog /var/log/httpd/143error.log
    CustomLog /var/log/httpd/143access.log combined
    </VirtualHost>

     vi /etc/hosts

  • 相关阅读:
    sed命令使用与正则表达式元字符
    centos6和centos7的网卡配置
    制作启动光盘centos6
    搭建一个私有CA
    yum命令
    while语法命令
    linux的进程与计划任务命令总结
    磁盘管理命令应用
    脚本命令与笔记
    重定向命令的使用
  • 原文地址:https://www.cnblogs.com/han1094/p/6368080.html
Copyright © 2020-2023  润新知