Apache-2.2

如何將另一個應用程序添加到 apache?

  • April 27, 2010

我正在關注Ubuntu 的 Zabbix 安裝教程,它要求我添加一個/etc/apache2/sites-enabled/000-default包含

Alias /zabbix /home/zabbix/public_html/
<Directory /home/zabbix/public_html>
 AllowOverride FileInfo AuthConfig Limit Indexes
 Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
 <Limit GET POST OPTIONS PROPFIND>
   Order allow,deny
   Allow from all
 </Limit>
 <LimitExcept GET POST OPTIONS PROPFIND>
   Order deny,allow
   Deny from all
 </LimitExcept>
</Directory>

但我已經有了/etc/apache2/sites-enabled/railsapp

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
   UseCanonicalName Off
   Include /etc/apache2/conf/railsapp.conf
</VirtualHost>

<VirtualHost *:443>
   SSLEngine on
   SSLCertificateFile /etc/ssl/certs/cert.pem
   Include /etc/apache2/conf/railsapp.conf
   RequestHeader set X_FORWARDED_PROTO 'https'
</VirtualHost>

/etc/apache2/sites-enabled/mercurial

NameVirtualHost *:8080

<VirtualHost *:8080>
   UseCanonicalName Off
   ServerAdmin  webmaster@localhost
   AddHandler cgi-script .cgi
   ScriptAliasMatch ^(.*) /usr/lib/cgi-bin/hgwebdir.cgi/$1
</VirtualHost>

我認為是因為已經存在的虛擬主機,我無法訪問 zabbix 頁面。如何規避這一點?

你有幾個選擇;1:將zabbix放在不同的埠上;2:使其在普通虛擬主機下可訪問。

對於 #1 更新 000-default 為:

DocumentRoot /home/zabbix/public_html

AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec Order allow,deny Allow from all Order deny,allow Deny from all

對於 #2

將 000-default 移動到 /etc/apache2/conf/zabbix.conf 並添加:

包括 /etc/apache2/conf/zabbix.conf

在 /etc/apache2/sites-enabled/railsapp 中類似的 Include 語句之上

引用自:https://serverfault.com/questions/136414