美文网首页
apache虚拟主机

apache虚拟主机

作者: lancelu | 来源:发表于2020-02-03 15:14 被阅读0次

    一、配置多个系统到不同的端口

    # httpd.conf中配置监听端口
    Listen 80
    Listen 82
    Listen 9999
    
    # vhosts.conf中配置
    <VirtualHost _default_:82>
      ServerName localhost
      DocumentRoot "项目路径"
      <Directory "项目路径">
        Options -Indexes -FollowSymLinks +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
      </Directory>
    </VirtualHost>
    
    <VirtualHost _default_:9999>
      ServerName localhost
      DocumentRoot "项目路径"
      <Directory "项目路径">
        Options -Indexes -FollowSymLinks +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
      </Directory>
    </VirtualHost>
    

    二、多个项目配置到一个主项目下

    # vhosts.conf中配置
    <VirtualHost _default_:80>
      
      ## 主目录
      DocumentRoot "路径"
      <Directory "路径">
        Options -Indexes +FollowSymLinks +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
      </Directory>
      
      ## 挂载到主项目下的子项目
      Alias /test1 "路径"
      <Directory "路径">
        Options -Indexes +FollowSymLinks +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
      </Directory>
    </VirtualHost>
    

    相关文章

      网友评论

          本文标题:apache虚拟主机

          本文链接:https://www.haomeiwen.com/subject/jxvhxhtx.html