Run PHP from a PNG file on lighttpd
I only need to do this for one file (uptime.php) and it must be requested by using uptime.png.
Adding a rule for all png files in my conf开发者_StackOverflow中文版ig file would be suicide.. :P
In general, it does not need to be requested by using uptime.png
: you can use a .php
extension. As long as your script outputs
Content-type: image/png
as the MIME type, browsers will recognise the data as an image.
However, if you really must use uptime.png
for the URL, you can use a rewrite rule. For example:
url.rewrite-once = ( "^/uptime\.png$" => "/uptime.php" )
There is more information about these rewrite rules in the Lighttpd Docs::ModRewrite documentation.
精彩评论