giza: Giza White Mage (Default)
I've been playing with Amazon EC2 over the weekend, and trying to set up popular software packages on it. I was able to get Munin set up, but every time I tried to load the Munin webpages (e.g. http://ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/munin/), I would get redirected to whatever the server_name directive was set to in Nginx. Usually it'd be something like "localhost", which was completely unhelpful.

I tried playing around with the server_name directive for awhile, and putting in the DNS name of the machine would work, but since I only used this instance sparingly, and starting it up caused it to be assigned a different IP each time, I would have to keep updating the config file. Not a viable solution.

I tried doing some fancy rewrites to the $server_name variable, but since Amazon's EC2 servers have their own internal IP in 10.0.0.0/8, my browser would just get redirected to an IP address that was not routable outside of Amazon's network.

I finally found the right directive:


server_name_in_redirect off;


This tells nginx to honor the Host: field in the initial HTTP request, instead of determining the name of the server on its own. This fixed the issue just fine.

Hopefully others will find this post and spend less time solving this problem than I did. :-)

(And yes, Ubuntu has official AMIs for EC2...)
giza: Giza White Mage (Default)
Been setting up a new machine for the migration of Anthrocon's webserver. This should address some of the speed issues we've been having as well as allowing us to use SSL on the site. Plus, since I now have root access and things like crontab available, I can start doing nightly rsyncs of the data.

Fun fact: Nginx lets you chain SSL certificates merely by appending the extra certificates on the end of your site's certificate. No extra webserver configuration requried!

Been building the pre-registration system for 2009, too. I expect that to be finished in the next few weeks. Also, I will be releasing the final product under the GNU Public License. I figure I can at least entertain others by letting them laugh at my code.

I slept poorly a few nights ago and must have done something to the muscles in my neck. This has resulted in me having headaches the last few days. Advil helps the symptoms, though.

Heading up north tomorrow to visit the family for a party. We're celebrating my kid sister's Masters Degree. Let her be the highest educated person in my family for a change. :-P

[Edit: Forgot to mention co-worker J. He wants to tag along with me to the next furry convention I attend, which would be FurFright. He has NO idea what he's in for! :-)]
giza: Giza White Mage (Default)
While using the nginx webserver with a Drupal installation I noticed something odd. Whenever I submitted a form (with the GET method) or clicked on a link that had a space in it, it would be converted to a plus sign in the URL. Actually, that's not the odd path--the web browser is doing proper URL encoding since spaces are not allowed in URLs.

The weird part is that after the request got to the webserver, and the server processed it and passed it to PHP, and PHP loaded Drupal and executed the PHP code, the plus sign failed to be turned back into a space when using the nginx webserver. Works fine in Apache, but not in nginx.

The symptom is that if I tried to perform a search or edit my user profile, or anything else that involved a plus sign in the GET data, when that data was processed by PHP, the plus sign was still there. i.e., I would see "term1+term2" in the search box, instead of "term1 term2".

So, how to fix this? I could have spent some time reading RFCs, and looking through the source from PHP and nginx, or I could have my site working again. I opted for the latter, and found that this line of code at the very beginning of Drupal's index.php seems to do the trick:

$_GET["q"] = strtr($_GET["q"], "+", " ");


It's silly, and may even be a bit stupid, but it sure does the trick.

Profile

giza: Giza White Mage (Default)
Douglas Muth

April 2012

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags