我试图在我的虚拟主机中使用RewriteMap,但没有得到任何运气。
以下是我的虚拟主机文件的内容,其中有一个以RewriteMap开头的条目(行)。据我所读,应该执行文件/etc/fixit.php。但是我测试了放置一个简单的行file_put_contents('/etc/test.txt','abcd', FILE_APPEND);和test.txt文件没有创建。
<VirtualHost *:80>
SuexecUserGroup "#1004" "#1004"
ServerName test2.domain.com
ServerAlias www.test2.domain.com
DocumentRoot /home/test2/public_html
ErrorLog /var/log/virtualmin/test2.domain.com_error_log
ErrorDocument 403 "This is the default page for new website."
CustomLog /var/log/virtualmin/test2.domain.com_access_log combined
ScriptAlias /cgi-bin/ /home/test2/cgi-bin/
ScriptAlias /awstats/ /home/test2/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
RewriteMap fixurl prg:/etc/fixit.php
<Directory /home/test2/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php7.0
FCGIWrapper /home/test2/fcgi-bin/php7.0.fcgi .php
FCGIWrapper /home/test2/fcgi-bin/php7.0.fcgi .php7.0
</Directory>
<Directory /home/test2/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RemoveHandler .php
RemoveHandler .php7.0
php_admin_value engine Off
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "test2.domain.com statistics"
AuthType Basic
AuthUserFile /home/test2/.awstats-htpasswd
require valid-user
</Files>
php_value memory_limit 32M
IPCCommTimeout 41
</VirtualHost>下面是我的测试/etc/fixit.php文件的内容
<?php
file_put_contents('/etc/test.txt','abcd', FILE_APPEND);
?>我知道这不是一个完整的RewriteMap示例,因为我没有在文件中添加重写规则。但是至少应该执行fixit.php文件,对吗?
谢谢你的帮助。
发布于 2017-07-29 07:54:40
尝试将您的fixit.php写到/tmp/test.txt;除非您的UID 1004对/etc具有写访问权限(它可能(但可能不应该)),fixit.php很可能正在运行,但无法创建该文件。
https://serverfault.com/questions/865784
复制相似问题