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).
Category: apache
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!
crashing fcgid 2.3.6 on windows
On Windows fcgid crashes apache when apache do a graceful restart (httpd -k restart). Here is a patch that should fix that. This patch in inspired from Tom Dovovan.
Index: modules/fcgid/fcgid_pm_main.c =================================================================== --- modules/fcgid/fcgid_pm_main.c (revision 1037552) +++ modules/fcgid/fcgid_pm_main.c (working copy) @@ -375,7 +375,9 @@ proc->diewhy = FCGID_DIE_SHUTDOWN; proc_print_exit_info(proc, exitcode, exitwhy, main_server); - apr_pool_destroy(proc->proc_pool); + #ifndef Win32 + apr_pool_destroy(proc->proc_pool); + #endif proc->proc_pool = NULL; return 1; } Index: modules/fcgid/fcgid_pm_win.c =================================================================== --- modules/fcgid/fcgid_pm_win.c (revision 1037552) +++ modules/fcgid/fcgid_pm_win.c (working copy) @@ -123,7 +123,9 @@ "mod_fcgid: can't create wake up thread"); exit(1); } - + apr_pool_cleanup_register(pconf, main_server, + procmgr_stop_procmgr, apr_pool_cleanup_null); + return APR_SUCCESS; } @@ -249,8 +251,6 @@ apr_status_t procmgr_child_init(server_rec * main_server, apr_pool_t * pchild) { - apr_pool_cleanup_register(pchild, main_server, - procmgr_stop_procmgr, apr_pool_cleanup_null); return APR_SUCCESS; }
Download this patch
Preparing mod_svn for compiling on windows
Well I didn’t manage it to compile mod_svn without the apache compiled source tree, but than it works fine and fast. Also Python 3 did not work. So I took 2.7
Assuming that OpenSSL 1.0.0a and zlib are compiled in that source tree as well.
C:\python27\python gen-make.py -t vcproj --vsnet-version=2008 --with-httpd=C:\build\httpd-2.2.x-sni-dev-ipv6 --with-openssl=C:\build\httpd-2.2.x-sni-dev-ipv6\srclib\openssl --with-zlib=C:\build\httpd-2.2.x-sni-dev-ipv6\srclib\zlib --with-apr=C:\build\httpd-2.2.x-sni-dev-ipv6\srclib\apr
Than just open subversion_vcnet.sln with Visual C++ Express Edition. Ignore all warnings about solution folders. Choose the __ALL__ project. Than change from debug to release. Start!
My sample config
LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule auth_digest_module modules/mod_auth_digest.so LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn/> DAV svn SVNListParentPath on SVNParentPath /Repositories/ SVNIndexXSLT "/svnindex.xsl" SVNPathAuthz on AuthzSVNAccessFile "C:/Repositories/authz" AuthName "Subversion Repositories" AuthType Basic AuthUserFile "C:/Repositories/htpasswd" require valid-user </Location>
compile zlib 1.2.5 on windows
Download from http://zlib.net/
extract it
For x86
nmake -f win32/Makefile.msc OBJA=inffast.obj MT -manifest zlib1.dll.manifest -outputresource:zlib1.dll;2
For x64
nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
Done :-)
Löschen
Auskommentieren ist löschen für Feiglinge!
Changed to event mpm
I made some testing on my dev machine and liked event mpm. So I installed it here. I noticed that the event mpm closes the connections faster than worker mpm. Some download tests sadisfied me. Less memory usage and faster serving :-) For now I keeped the settings from worker mpm. I’ll look for tweaking in the next days.
Different to the docs event mpm works fine with SSL.
sudo apt-get install apache2-mpm-event libapache2-mod-fcgid
Also the serving PHP over fcgid is nice. The implementation of PHP over fcgid in the older post.
SSH Tunnel Bypassing Transparent proxy using apache
A feature of the apache webserver is that it allows to to create a SSH connection through a transparent proxy / firewall. This is a stealth technic so no one will see it even in a large company network. Only IPoAC is able to interference this.
If you have internet access to port 80 (http) or 443 (https) you can establish a SSH connection to one of that ports. Proxys want the users to surf the web. most of the proxyes will only let their users through the paths they know safe (or whatever filtering their administrators may have set). In the best scenario, the proxy will not allow one particular HTTP method called CONNECT. This method is the one used for SSL / TLS protocol. It establishes a tunneled connection between the client and a remote server, through the proxy server. Since it is used by SSL / TLS, some proxys will let the CONNECT method free to certain sites, and most probably only on port 443.
Apache plus mod_proxy module will let us set up an HTTP server listening on port 80, and at the very same time an HTTP proxy. The proxying part is done by mod_proxy. This module turns Apache into a fully functional HTTP forward-proxy and reverse-proxy. the exciting feature of mod_proxy is its ability to handle the CONNECT method. It will even handle it if the transparent proxy, at the boundaries of our enterprise network, does not allow the CONNECT method. This, because we will talk GET and POST with Apache, the CONNECT thing happens inside Apache, and outside of the control of the enterprise proxy. The end result: we can use the CONNECT method.
Client side
- SSH Client
- Proxyclient
server side
- apache webserver 2.x
This is an example virtual host configuration which I used for testing this implementation.
<VirtualHost *:80> ServerName proxy.mydomain.com ProxyRequests On AllowCONNECT 22 <Proxy *> Order deny,allow Deny from all </Proxy> <ProxyMatch (host1|host2)\.mydomain\.com> Order deny,allow Deny from all #Now we allow only our IP to access. Note that this IP must be the public IP address of the enterprise proxy: Allow from 222.22.22.100 </ProxyMatch> # This directive enables DNS lookups so that host names can be logged. The value Double refers to doing double reverse DNS lookup. #That is, after a reverse lookup is performed, a forward lookup is then performed on that result. At least one of the IP addresses in the forward lookup must match the original address. It is paranoid but is a good security measure HostnameLookups Double ErrorLog /var/log/apache2/proxy.error.log CustomLog /var/log/apache2/proxy.access.log common </VirtualHost>
And now, the final step: configure our browser to use 127.0.0.1 on port 8080 as proxy. Finally we can login to our SSH server and try pointing our browser to any website we know blocked by the enterprise transparent proxy!
I know I left the part setting up apache and proxy, but this isn’t a tutorial for noobs ;-)
This is the BEST part of using Apache. You can set it up as normal web server, serving some webpage. This way whoever point to mydomain.com will see a normal and harmless website, and won’t be able to distiguish it from a non-proxying server.
reverse proxy for utorrent
Using the web UI for utorrent is a fine thing. But the webserver from utorrent is not secure. So it is recommend to use apache as reverse proxy. I tried to change the url, but I wasn’t successful.
Here the set up of cause inside a vhost.
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_http_module modules/mod_proxy_http.so ProxyPass /gui/ http://localhost/gui/ ProxyPassReverse /gui/ http://localhost/gui/
roundcube dislikes PHP 5.3
The current stable version ( 0.3) and the latest beta (0.4 beta) of roundcube dislike my upgrade tp PHP 5.3 All other applications run fine, but roundcube. Searching in the logs showed me that there are some PHP 4 code is used and often PHP 4 coding style. The manual says that at least PHP 5.2 must be used or greater. Super, since it does work with 5.3
Good that I’m a PHP developer myself and I found the places in the code I had to change. I had no fun to rewrite the whole code to PHP 5 style. So I just fixed it.What I have changed?
program/lib/MDB2.php on line 392
program/lib/MDB2.php on line 2614
program/lib/PEAR.php on line 563
program/lib/PEAR.php on line 566
By removing the “&”. I also searched for “=&” and replaced it with “=”. Quick and maybe dirty, but now I can check my mails again. I wonder how say you have to use PHP 5.2 or greater and still using that crap code?
Archive for category apache
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