I still dislike the 500 error handling in lua. Well scripting got easier with practicing :P But the error handling realy sux a lot compared to PHP where I come from. I made a bit “benchmarking”. OK I took very different scripts, but PHP seems faster to me than lua. Plus for lua is that you are able to write direcly into apache log files.
Author: mario
Happy 7DB
Happy 7DB to you geeks ;-)
first script for mod_lua apache2.3/2.4
function handle(r) r.content_type = "text/html" --r.headers_out["X-Powered-By"] = "mod_lua; " .. _VERSION r:puts("Hi!") return apache2.OK end
Mod lua expects a function with the name handle() else there is a 500 Error. The error handling is pretty anoying…
compile lua on windows
Grab the “newest” (2008) http://www.lua.org/ftp/lua-5.1.4.tar.gz
unpack it. Compiling with VC++ is very easy.
Open the x64 %comspec% /E:ON /V:ON /T:0E /K “C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.cmd” /Release
or x86 command line
%comspec% /k “”C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat”” x86
browse to lua folder and run
etc\luavs copy /y src\*.* .\
Done!
build mod_geoip
Obtain GeoIP-1.4.6 from maxmind.com and built per included instructions.
Build Module against an IPv6 Enabled Apache Build
Obtain GeoIP-1.4.6 from maxmind.com and built per included instructions. Build Module against an IPv6 Enabled Apache Build del *.obj *.exp *.lib *.so set APACHE=C:\Apache22 set GEOIPROOT=C:\Build\GeoIP-1.4.6 cl /nologo /MD /O2 /LD /W3 -DWIN32 -D_WIN32 -I%GEOIPROOT%\libGeoIP -I%APACHE%\include /c /Fomod_geoip.obj mod_geoip.c link /NODEFAULTLIB:LIBCMT kernel32.lib "%APACHE%\lib\libhttpd.lib" "%APACHE%\lib\libapr-1.lib" "%APACHE%\lib\libaprutil-1.lib" "%GEOIPROOT%\libGeoIP\GeoIP.lib" /nologo /subsystem:windows /dll /machine:I386 /out:mod_geoip.so mod_geoip.obj
patch requires admin privileges on Windows 7
The patch.exe requires admin privileges on Windows 7. This is pretty annoying! The first thing that worked was just renaming the file to pach.exe Stupid windows. But I didn’t like that cause than I mostly typed it wrong and patch command was missing. I found a better solution:
Create a text file in the same directory with the name patch.exe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker"/> </requestedPrivileges> </security> </trustInfo> </assembly>
Save as UTF8. Now it works. Well I have to test if it is possible to embedd the manifest than good bye $%&# asking for admin permission
Giving mod_logrotate a signature
This is my first trial giving a third party module a signature.
--- mod_log_rotate.c.orig 2008-07-24 13:17:45.000000000 +0200 +++ mod_log_rotate.c 2010-11-21 02:31:43.123503300 +0100 @@ -399,6 +399,19 @@ return add; } +/* map into the first apache */ +static int log_rotate_post_config( apr_pool_t * p, apr_pool_t * plog, apr_pool_t * ptemp, server_rec * s) +{ + ap_add_version_component(p, "mod_log_rotate/1.00"); + return OK; +} + +static void log_rotate_register_hooks(apr_pool_t *p) +{ + ap_hook_post_config( log_rotate_post_config, NULL, NULL, APR_HOOK_MIDDLE ); +} + + module AP_MODULE_DECLARE_DATA log_rotate_module = { STANDARD20_MODULE_STUFF, NULL, /* create per-dir config */ @@ -406,6 +419,6 @@ make_log_options, /* server config */ merge_log_options, /* merge server config */ rotate_log_cmds, /* command apr_table_t */ - NULL /* register hooks */ + log_rotate_register_hooks /* register hooks */ };
reverse proxy for utorrent part 2
In my last post about utorrent (µtorrent) I was frustrated that I wasn’t able to change the url from /gui/ to /tor/
Woot! In apache 2.3 which will be apache 2.4 and I think it will be released in early 2011 the proxy module is much better and there it works to have a different URL :-) Even as ALPHA or BETA version the new apache rocks a lot and runs stable. In condition with mod_fcgid it is real cool technology e.g. running PHP separated form apache that allows to run different PHP version of the server in vhosts or directories. Also running a non thread safe PHP version. Speed! IPv6 would be fine, but the offered patches are not applied to trunk :-/There is an annoying bug in mod_fcgid. I’m glad I found a fix for it (help from Tom Donovan and Sob).
Disable AllowOverride (htaccess to httpd.conf)
AllowOverride is one of the things that slow down a lot. Disabling it makes apache faster. It is a horror to migrate all .htaccess files by hand. BUT here is a PHP script from Paul Reinheimer which makes it realy easy :-)
Get it htaccess.php
tune your server!
Author Archive
Archives by Month:
- February 2025
- January 2025
- December 2024
- November 2024
- October 2024
- August 2024
- April 2024
- January 2024
- December 2023
- November 2023
- July 2023
- May 2023
- April 2023
- March 2023
- February 2023
- January 2023
- December 2022
- October 2022
- September 2022
- August 2022
- July 2022
- May 2022
- March 2022
- February 2022
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- June 2021
- May 2021
- February 2021
- January 2021
- August 2020
- July 2020
- June 2020
- April 2020
- January 2020
- December 2019
- November 2019
- October 2019
- May 2019
- April 2019
- March 2019
- January 2019
- October 2018
- August 2018
- June 2018
- April 2018
- March 2018
- February 2018
- November 2017
- June 2017
- April 2017
- February 2017
- January 2017
- November 2016
- September 2016
- May 2016
- February 2016
- September 2015
- August 2015
- July 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- July 2014
- June 2014
- April 2014
- January 2014
- December 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- August 2012
- July 2012
- June 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009