我在Apache 2.2上使用mod_userdir爲多個用戶提供了訪問Web服務器的權限(用於他們的測試和其他內容)。如何根據mod_userdir的用戶擁有不同的Apache2日誌文件?
我想給我的用戶訪問Apache日誌(以便他們可以調試他們的腳本),但日誌條目(包括ErrorLog
和CustomLog
:error.log中和的access.log)結合在一起(無論「用戶」目錄)。
有沒有辦法將日誌分成多個文件(取決於用戶)。
Apache的版本:2.2.16
「的/ etc/apache2的/網站啓用/ 000-默認」 配置文件:啓用MODS-
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
「的/ etc/apache2的/ /userdir.conf「配置文件:
<IfModule mod_userdir.c>
UserDir /home/*/public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Options
Options MultiViews Indexes IncludesNoExec
IndexOptions FoldersFirst FancyIndexing IgnoreCase
php_admin_value open_basedir "..:/usr/share/php/"
</Directory>
ErrorLog /tmp/apache2-userdir-error.log
LogLevel warn
CustomLog /tmp/apache2-userdir-access.log
</IfModule>
我錯過了'SetEnvIf'和'CustomLog'的實現......我的具體問題在這裏:http://stackoverflow.com/q/16154718/32836,並希望你的洞察力... – Jamie
我收到了名爲'access _ $ {username} .log'的日誌文件。它沒有擴大變量。有任何想法嗎? – user1751825
我也無法獲得變量擴展。我試過了一堆$ {},%{} e,引號和沒有引號的組合。我在這裏找到[鏈接](https://bz.apache.org/bugzilla/show_bug.cgi?id=59371)添加一個冒號擺脫了警告,但它仍然不擴大。 – bmsauer