【问题标题】:Set up apache with multiple virtualhosts使用多个虚拟主机设置 apache
【发布时间】:2013-03-03 07:44:06
【问题描述】:

我无法让虚拟主机按我的意愿工作。过去几个小时我一直在寻找,但感觉比以前更迷失了。

所以基本上我想要以下设置:

  1. http://test.localhost => D:\xampp\htdocs\test\site
  2. http://test.localhost/call => D:\xampp\htdocs\test\back\call.pl
  3. 还可能添加其他内容,例如 /whatever 指向其他 .pl 脚本

谁能给我一个提示?我一定错过了一些明显的东西......

【问题讨论】:

    标签: apache mod-rewrite virtualhost virtual-hosts


    【解决方案1】:

    对于 localhost 子域,您必须将该子域添加到 /etc/hosts

    127.0.0.1       localhost       test.localhost
    

    【讨论】:

      【解决方案2】:

      您是否尝试编辑您的 apache conf 文件?

      像这样的

      # vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
      NameVirtualHost *:80
      
      <VirtualHost *:80>
       ServerAdmin ramesh@thegeekstuff.com
       DocumentRoot "/usr/local/apache2/docs/thegeekstuff"
       ServerName thegeekstuff.com
       ServerAlias www.thegeekstuff.com
       ErrorLog "logs/thegeekstuff/error_log"
       CustomLog "logs/thegeekstuff/access_log" common
      </VirtualHost>
      
      <VirtualHost *:80>
       ServerAdmin ramesh@top5freeware.com
       DocumentRoot "/usr/local/apache2/docs/top5freeware"
       ServerName top5freeware.com
       ServerAlias www.top5freeware.com
       ErrorLog "logs/top5freeware/error_log"
       CustomLog "logs/top5freeware/access_log" common
      </VirtualHost>
      

      【讨论】:

        猜你喜欢
        • 2016-08-31
        • 2017-05-30
        • 2013-07-31
        • 1970-01-01
        • 2021-11-01
        • 2021-12-29
        • 2012-04-22
        • 1970-01-01
        • 2013-05-22
        相关资源
        最近更新 更多