• 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

  • 相关阅读:
    [分治FFT]「CTSC2018」青蕈领主
    [边分治+线段树合并]「CTSC2018」暴力写挂
    [模板]MTT
    [模板]NTT
    [矩阵求逆+二分图匹配]BZOJ 3168 [Heoi2013]钙铁锌硒维生素
    [BZOJ1925][SDOI2010]地精部落(DP)
    [BZOJ1047][HAOI2007]理想的正方形(RMQ+DP)
    [POJ3630]Phone List (Tire)
    [POJ1193][NOI1999]内存分配(链表+模拟)
    [POJ2823]Sliding Window 滑动窗口(单调队列)
  • 原文地址:https://www.cnblogs.com/han1094/p/6368080.html
Copyright © 2020-2023  润新知