Sunday 14 June 2009

Configuring Apache to proxy requests to Nginx

This morning I went on Animal Crossing, then went to Church with L, as Moccle is visting Flukester in Man's field. After that I went on Animal Crossing a bit more, then it was dinner time.

After dinner I checked my email, then I went to bed as I was headachy and sleepy.

I got up again about 15.30, and went in the garden with Ben for a bit. There seemed to be plenty of different insects around.

Then I came back inside and decided to look at installing Nginx. I wanted to try installing it on my Ubuntu virtual machine first, which meant I needed to figure out how to get apache to proxy requests to another port or socket. First I needed to check that apache had mod_proxy installed, after a bit of searching I found where apache had stored its modules in Ubuntu: /usr/lib/apache2/modules.

I read quite a few of different articles on forwarding ports using Apache, but found this article most helpful: Using Apache Virtual Hosts and ProxyPass Together.

I did quite a bit of googling and reading on nginx, and got that installed. When I tested my page by going straight to the domain/port that Nginx was serving, I got the page okay.

But when I tried to access it without the port (so the address that apache should have been proxying to Nginx on the correct port), I just got a Forbidden page. So I guess I must have done something wrong in configuring Apache.

Doing some googling most suggestions about this problem were to do with missing the proxy module(s) from the apache httpd.conf file. My file didn't have any of the lines to load the modules, but I had done sudo a2enmod proxy etc. for the various proxy mods I needed, and restarted apache.

But one of the suggestions, said about checking the apache logs, so I did this and found
mod_proxy: client denied by server configuration: proxy:http://localhost:5678/
Googling for this I found this thread: mod_proxy: client denied by server configuration: proxy:http://otherserver. Editing /etc/apache/mods-available/proxy.conf, and changing 'Deny from all' to 'Allow from all' fixed it.

The weather today was (again) a blue sky with quite a bit of cloud, and sunny nearly all day. I didn't see much of the sunset, but it looked like it was probably quite good.

Food
Breakfast: Orange marmalade toast sandwich; cup o' tea.
Dinner: Nasi Goreng; noodles. Pudding was a slice of jam swiss roll with tinned pear halves and custard. Cup o' tea.
Tea: Mature cheddar cheese sandwich made with fresh bread-maker-made bread; slice of fresh bread-maker-made bread with orange marmalade; satsuma; apple pie; Rocky; cup o' tea; Oreo.

No comments: