htaccess redirect secure URL, redirect old assets to Amazon S3, only for https
I have the following URL, I would like to redirect all css, images & javascript to my amazon s3 bucket. # I have these URL’s (and more) https://secure.mydomain.co.uk/styles/donate/style.css https://secure.mydomain.co.uk/js/donate/jquery.min.js https://secure.mydomain.co.uk/images/donate/help-icon.png# I would like to redirect all CSS, JS & Image files to: https://s3-eu-west-1.amazonaws.com/mydomain.co.uk/static/$1# So the URLs should be https://s3-eu-west-1.amazonaws.com/mydomain.co.uk/static/styles/donate/style.css https://s3-eu-west-1.amazonaws.com/mydomain.co.uk/static/js/donate/jquery.min.js https://s3-eu-west-1.amazonaws.com/mydomain.co.uk/static/images/donate/help-icon.png# All other .php files, I want served using my normal secure.mydomain.co.uk https://secure.mydomain.co.uk/other/php/files.php I have tried the following, but it don’t work as expected: RewriteCond [...]
Continue Reading »trying to get apache mod_stats ‘/server-status’ to work
mod_status is a apache module that lets you see the status of apache. After its switched on, it can be accessed at server.com/server-status, however I cant access it because of the mod_rewrite in the .htaccess file. below is the .htaccess file. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} othersite.com$ [NC] RewriteRule ^(.*)$ http://server.com/$1 [R=301]RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]</IfModule> when I disable above, http://server.com/server-status works. This is probably a common [...]
Continue Reading »Automatic wildcard subdomains on Apache
Currently I have several virtual hosts set up for individual subdomains. It would be a lot easier if I could tell Apache to automatically find the folder using a wildcard. For example, hello.domain.com would use the /var/www/hello directory as its DocumentRoot. I would like to be able to define exceptions however, such as if I wanted helloworld.domain.com to point to /var/www/helloworld/public instead. I’ve looked around but all of the examples seem to be doing something [...]
Continue Reading »Apache as reverse-proxy for tomcat (running jenkins)
I have set up apache to work as a reverse proxy to tomcat that is running jenkins-CI. I can access the site from outside fine, except when I log in to jenkins, it redirects to my lan-hostname, and it of course it fails outside my network. After that I can manually type the original address to the browser, and it it will work fine until I have to log in again. I wonder if this [...]
Continue Reading »File readable by only PHP?
I’d like to make a file on my server be readable by PHP, but not directly accessible with a browser. Say my Apache installation’s root is /apache. I’d like PHP to be able to get the text of /apache/1.txt, but not allow the user to go to domain.tld/1.txt and view the contents. I’d still like to be able to read/write the file through FTP/SFTP without root. What would be the propper chmod string for this? [...]
Continue Reading »Apache2: VirtualHost and Django
We’re hosting two sites and don’t have a domain name at the moment so we’re using the IP address. I want the two sites to be accessed in the following manner: http://123.123.123.123/Site1 http://123.123.123.123/Site2 Site1 is a small About us type site. Site2 is a Django-based file upload site. Here’s my httpd.conf file: WSGIPythonPath /var/www/Site2/src/site Listen 80 NameVirtualHost *:80# Site1 <VirtualHost *:80> ServerName Site1 DocumentRoot /var/www/Site1 </VirtualHost># Site2 <VirtualHost *:80> ServerName Site2 WSGIScriptAlias /Site2 /var/www/Site2/src/site/wsgi.py <Directory [...]
Continue Reading »Apache proxypass max config option and maxclients interaction
I am having some issues with an apache proxying to a local tomcat instance. The i have traced the issue down to the way maxclients and proxypass direvtives interact. in a test environment I set up apache to have 3 max clients and proxypass to have a max of 2 connections to the ajp connector. maxclients 3 proxypass /player ajp://localhost:8009/player max=2 To illustrate the issue I have firewalled 8009 so requests will have to timeout [...]
Continue Reading »Why is Varnish not caching my index page properly?
I have a Varnish set up in front of Apache 2 on Ubuntu 11.10. I’m using this VCL file: backend default { .host = “127.0.0.1″; .port = “8080″; }sub vcl_recv { if (req.url ~ “^/web”) { unset req.http.cookie; } if (req.url ~ “administration” || req.url ~ “preview” ) { return(pass); } if (req.http.Cookie) { set req.http.Cookie = “;”+req.http.Cookie; set req.http.Cookie = regsuball(req.http.Cookie, “; +”, “;”); set req.http.Cookie = regsuball(req.http.Cookie, “;(mag_header)=”, “; \1=”); set req.http.Cookie = [...]
Continue Reading »share a domain name beween php and mono
I’ve got a problem : I’ve got a dedicated server where I use three different domain names and php. Now, I’ve got a new website that I developped with asp.net. I installed mono, mod_mono and transfered my assembly inside /var/www/mysite My problem comes up when I try to access my website. I tried IpAdress/mysite/ but it just gives the three and if I want “IpAddress/mysite/Controller1/Action1″ it says 404. As I said my server is apache [...]
Continue Reading »Slash after domain in URL missing for Rails site
After redirecting users in a Rails app, for some reason the slash after the domain is missing. Generated URLs are invalid and I’m forced to manually correct them. The problem only occurs on a subdomain. On a different primary domain (same server), everything works ok. For example, after logging out, the site is directing to https://www.sub.domain.comlogin/ rather than https://www.sub.domain.com/login I suspect the issue has something to do with the vhost setup, but I’m not sure. [...]
Continue Reading »Recent Posts
- Windows File Permissions and Attributes
- What is the easiest way to upgrade my existing Perl 5.14 to Perl 5.16 on FreeBSD 9 using the ports system?
- Know if mysql has done its job
- Redirect https .com to https .co.uk without a valid SSL cert on .com without DNS change
- Why is it a bad idea to use customer email as from address



