zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    你知道吗,Flutter内置了10多种show
    强大的Flutter App升级功能
    Flutter 日期时间DatePicker控件及国际化
    你知道吗,Flutter内置了10多种Button控件
    Flutter Form表单控件超全总结
    Flutter 裁剪类组件 最全总结
    Flutter 拖拽控件Draggable看这一篇就够了
    Python 浮点数的冷知识
    Python 为了提升性能,竟运用了共享经济
    Python 之父的解析器系列之六:给 PEG 语法添加动作
  • 原文地址:https://www.cnblogs.com/han1094/p/6368080.html
Copyright © 2011-2022 走看看