Monday, June 30, 2014

GET through URL Rewrite Lighty lighttpd

one quick post about handling this. it took me a few hours to figure this out. make sure you handle the URL rewrite in the lighttpd conf otherwise you will see your GET params being dropped in PHP at least that was my experience here is the link where I found the correct wayt to rewrite through lighttpd


http://redmine.lighttpd.net/projects/1/wiki/Docs_ModRewrite


and then also check it out github for Slim example which is the framework I was using


https://github.com/codeguy/Slim/issues/405

Thursday, June 26, 2014

Lighttpd Permission denied on home directory Alias

I recently ran into problems trying to set up lighttpd on redhat and giving home directory access for alias URL's After chmod and chown on all folders and directories I could see the log throwing a permssion denied when trying to display contents from the home folder. I was confused and spent a lot of time trying figure out what the problem was. It turns out this Article helped me understand a little more about the problem I faced

http://wiki.centos.org/HowTos/SELinux this link showed me how to check if SELinux is working and also understand about permissions to different processes. After I ran the following command

chcon -Rv --type=httpd_sys_content_t /home/lighttpd

everything started working. It had the wrong type and it was not allowing lighttpd to read the contents of the directory. I hope this helps someone out if the run into this problem.

Friday, May 30, 2014

Lighttpd, Python and Django

Before I continue I would like to say there are a lot of   great tutorials out there for setting up Lighttpd, Python and Django. I guess my case is a little different maybe not by much. I went from developing all of my django apps in windows server IIS 7 so things were a little different. For example in windows I used Python 2.7 in Redhat it comes with Python 2.6 by default but needed to upgrade or install Python 2.7 for that I loaded the repo from Python27 and installed then installed PIP for Python 27 and started installing all the libraries I had in windows. I will do a full write down of my install as for me it was difficult to figure out permissions and getting them on the right files

Thursday, May 22, 2014

Linux Redhat 5 and Lighttpd

While installing and configuring Lighttpd for Redhat. I came across a problem that took me hours to figure out. After a lot of research I found the answer.

Problem:
           While everything was setup correctly, I could serve php pages, I  could not connect to my database (Postgres). I checked everything I could to make it work. the error I was receiving was


Database error

Message: SQLSTATE[08006] [7] could not connect to server: Permission denied Is the server running on host "myserver" and accepting TCP/IP connections on port 9999?
to make matters a bit more difficult for me I had PGPOOL-II infront of the my db and had to troubleshoot both pg_hba.conf files from master db to PG_POOL which in my case were two different servers. After hours of trying to reconfigure my pg_hba.conf file I googled and came across this  post which saved my life.


Solution:
         If you try to install lighttpd make sure you give permissions to the process setsebool -P httpd_can_network_connect on otherwise you will wont be able to connect to postgres from php.