我想在我的虚拟主机中使用RewriteMap ,但没有得到任何好运。
这里是我的虚拟主机文件的内容,以一个从RewriteMap开始的条目(行)。 从我读的文件/etc/fixit.php应该被执行。 但我testing了把简单的行file_put_contents('/etc/test.txt','abcd', FILE_APPEND); 并且不会创buildtest.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>
这里是我的testing/etc/fixit.php文件的内容
<?php file_put_contents('/etc/test.txt','abcd', FILE_APPEND); ?>
我明白,这不是一个完整的RewriteMap的例子,因为我没有添加一个重写规则的文件。 但至lessfixit.php文件应该被执行,是否正确?
谢谢你的帮助。
尝试使你的fixit.php代替写入/tmp/test.txt; 除非你的UID 1004拥有对/ etc的写入权限(可能,但可能不应该),fixit.php可能正在运行,但无法创build文件。