apache

Disable Apache 503 response when Tomcat is down

We have some independent servers, connected behind a hardware balancer. Each one of the machines is running Apache 2.2, Tomcat 5.0 and mod_proxy_ajp as the connector. Everything works fine, but when Tomcat is shutdown, Apache returns error code 503 (as it's expected to do, I guess). The problem is our load balancer, which doesn't interp...

Custom PHP FastCGI interface? (Faster?)

How do you build your own FastCGI interface in PHP? I'd like to do something similar to what they're doing in Perl, but in PHP. Is it even possible? Would it be faster? (That is, I'd like to be able to load a web app framework once into memory, and then just have FastCGI call a method I provide for every request. So not the more generi...

How can I store my Rewrite Rules in a database?

Hey everyone, Im developing a new site, and I'd like to store my rewrite rules in a database, instead of right in the .htaccess files. I have another site that uses Opensef (http://sourceforge.net/projects/opensef/) with a Joomla! installation that is doing this, but im not even 100% how it works underneath the hood. How can I store t...

apache permissions error

I have an Ubuntu Hardy slice with Passenger Phusion serving up a rails app. I am also using the sphinx full text seach with the thinking_sphinx plugin I can run this command from the terminal: sudo rake ts:index RAILS_ENV=production but if this command is in the capistrano deploy file : run "cd #{current_path}; rake thinking_sphinx:...

newly installed apache serving html content as text

I am running an Apache instance on Ubuntu and am having this problem: .HTML files with bonafide HTML inside is being served as a text file: > **For eg. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html> > <body> <h1>Index to Butterthlies > Catalogs</h1> etc. etc.** I checked the header in firebug and sure enough the page is pl...

how to set a header when serving a static file

I want to host an ical file, but when serving it, I need to set the Content-type header to calendar and stuff in php, I would just <?php header ("Content-type: text/calendar") ?> //calendar stuff proceeds Can I do the same using ruby? or can I somehow tell apache to set a different header when serving this file? ...

Parse the HTTP_COOKIES string from Apache for use in #if clause

I want to be able to read the cookies from Apache's HTTP_COOKIE string and then add includes based on the contents of that string. I've got this far: <!--#set var="cookies" value="HTTP_COOKIE" --> <p>COOKIES: <!--#echo var="$cookies"--></p> which gives me a string with all the cookies in it. Now I want to be able to parse the strin...

How Do I Restrict Repository Access via WebSVN?

Note: I originally asked this question on serverfault.com but only got one response so far, and the more I think about it, the more I realise it is probably better on stackoverflow. I have multiple subversion repositories which are served up through Apache 2.2 and WebDAV. They are all located in a central place, and I used this debian-a...

How to generate a client certificate using a third party CA-NOT Self Signed CA

I am trying to trying to export a client certificate for use with a web browser. The goal is to restrict access using the <Location> directive to the admin area. I have seen numerous tutorials on using self signed CAs. How would you do this using a third party? 1) Do I need to include the CA in the client pfx if it is a trusted root ...

Apache URL Rewriting,

Hey folks, I am trying to get URL rewriting to work on my website. Here is the contents of my .htaccess: RewriteEngine On RewriteRule ^blog/?$ index.php?page=blog [L] RewriteRule ^about/?$ index.php?page=about [L] RewriteRule ^portfolio/?$ index.php?page=portfolio [L] #RewriteRule ^.*$ index.php?page=blog [L] Now the 3 uncommented re...

Page anchor with mod_rewrite?

I'm trying to set up page anchors on a website that uses mod_rewrite (Apache2 running on Ubuntu Server 9.04). My htaccess file looks like this: RewriteEngine On RewriteRule ^information.php/([A-Za-z0-9-]+)/?$ information.php?display=$1 [NC,NE] If I was using regular URL's the query would look something like this: http://mydomain/info...

Check if a pdf file is valid using PdfBox by Apache

I am using PdfBox in Java to extract text from PDF files. Some of the input files provided are not valid and PDFTextStripper halts on these files. Is there a clean way to check if the provided file is indeed a valid PDF? ...

Apache mod-proxy load balancer maintenance

I have mod-proxy and mod-proxy-balancer setup as a load balancing reverse proxy. Something like this: <Proxy balancer://example> BalancerMember http://hostname:8000 keepalive=on BalancerMember http://hostname:8001 keepalive=on </Proxy> ProxyPass / balancer://example/ ProxyPassReverse / balancer://example/ ProxyPreserveHost on P...

Flash-based file upload (swfupload) fails with Apache/mod-wsgi.

This question has been retitled/retagged so that others may more easily find the solution to this problem. I am in the process of trying to migrate a project from the Django development server to a Apache/mod-wsgi environment. If you had asked me yesterday I would have said the transition was going very smoothly. My site is up, acce...

.htaccess not working (mod_rewrite)

I have not having any luck getting my .htaccess with mod_rewrite working. Basically all I am trying to do is remove 'www' from "http://www.example.com" and "https://www.example.com". If there is anything I am missing (conf files, etc let me know I willl update this) Here is my .htaccess file (located @ /var/www/site/trunk/html/) Opti...

Mercurial push, abort: authorization failed.

I'm having problems with pushing to mercurial repository: $ hg push pushing to https://user:***@hg.domain.com/X_repo searching for changes abort: authorization failed The same URL (with the same credentials) is accessible through the web browser. Also, I tried it without embedding usr+pass into the URL. HTTPS is correctly configured,...

Why do images served from my web server not cache on the client?

I store all of my images behind the webroot (before /var/www/), which means that the web server is unable to send cache headers back for my pictures. What do I need to add to this to make the user's web cache work? Currently, this is getting hit every time by the same browser. My <img> path on my pages look something like this: <img s...

mod_rewrite for any number of variables

I am a newbie to mod_rewrite and I was wondering if there is any way you could make on rewrite script that handles and number of variables you throw at it. Example: www.krisnicolaou.com/index.php?id=5&sort=asc&limit=25&param=first_name to www.krisnicolaou.com/5/asc/25/first_name ...but, you can also pass these variables in on another ...

Rails swfupload and apache configuration issue

I am trying to use swfupload with rails . I configured everything , passing the session_id and authenticity token in the URL and it works great on my local environment ( webrick ) . However when I deploy it on production with Apache , everything works fine except the swfupload . I keep on getting 301 error code . After trying http sn...

PHP stops rendering page somewhat arbitrarily

I've spent all morning trying to find an answer to this, to no avail. I'm working on a website, and I set up a small test server to make changes on. When I loaded the page I had made a few changes to, I noticed that the page stopped short. I reloaded the page, and it stopped at a different place. I reloaded again and again, and noticed t...