ServerAlias in apache,ubuntu

时间:2016-08-17 13:33:12

标签: apache ubuntu virtualhost

我在ubuntu上有一个虚拟主机apache,这不是我的主配置,我有另一个网页作为我的主要,所以我想用虚拟主机在同一个IP上设置这个。

urologyexpert.mx是我的服务器名称,这很完美,但我希望有几个别名来访问这个页面

我把服务器别名:
www.urologyexpert.mx(不起作用)
urologoexpertomonterrey.mx(不起作用)
www.urologoexpertomonterrey.mx(工作)

无法使用的那个将被路由到此IP上的默认网页

这是我在/ etc / apache2 / sites-enabled中的apache配置

为urologyexpert.mx和urologoexpertomonterrey.mx设置了记录,两者都指向相同的IP,我有一个针对urologyexpert.mx的www的CNAME

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName urologyexpert.mx
    ServerAlias www.urologyexpert.mx, urologoexpertomonterrey.mx, www.urologoexpertomonterrey.mx

    DocumentRoot /var/www/urologyexpert.mx
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www/urologyexpert.mx>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride All
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

有人可以帮我吗?我只是无法弄清楚为什么一个别名正在工作而两个不是

1 个答案:

答案 0 :(得分:1)

好的,我实际上现在知道问题是什么,

多个ServerAlias必须用空格分隔,而不是逗号,这就是为什么只有ServerName和最后一个Alias工作的原因

private static int StartScanning(ClientApi api, string apiKey, string url)
{
  var apiResponse = api.spider.scan(apiKey, url, "");
  string scanid = ((ApiResponseElement)apiResponse).Value;
  return int.Parse(scanid);
}

private static int StartActiveScanning(ClientApi api, string apiKey, string url)
{
  var apiResponse = api.ascan.scan(apiKey, url, "true", "", "", "", "");
  string activeScanId = ((ApiResponseElement)apiResponse).Value;
  return int.Parse(activeScanId);
}

private static void PollTheSpiderTillCompletion(ClientApi api, int scanid)
{
  int spiderProgress;
  while (true)
  {
    Thread.Sleep(1000);
    spiderProgress = int.Parse(((ApiResponseElement)api.spider.status(Convert.ToString(scanid))).Value);
    if (spiderProgress >= 100)
      break;
  }

  Thread.Sleep(10000);
}

private static void PollTheActiveScannerTillCompletion(ClientApi api, int activeScanId)
{
  int activeScannerprogress;
  while (true)
  {
    Thread.Sleep(5000);
    activeScannerprogress = int.Parse(((ApiResponseElement)api.ascan.status(Convert.ToString(activeScanId))).Value);
    if (activeScannerprogress >= 100)
      break;
  }
}

我希望这有助于某人