Config for a PHP REST web service

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
I am working on a small REST-based web service that I write in php.
I have a single PHP-script and I want Apache to route all requests to a specific location and below to my php script.

This is how I did it:

<LocationMatch "^/pathtomyservice(.*)" >
<Limit GET POST PUT DELETE OPTIONS>
        Order allow,deny
        Allow from all
</Limit>
<LimitExcept GET POST PUT DELETE OPTIONS>
        Order deny,allow
        Deny from all
</LimitExcept>

    Options -All
    SetHandler MyService
    Action MyService /~myuser/somepath/myscript.php virtual
</LocationMatch>

of course, I had to enable UserDir for myuser.

My problem is: I have no idea what I am doing. It's all trial-and-horror. Now it works as expected but somehow it feels a bit strange.

I expected to be able to tell Apache that "for this path run that php script" and not that the script had to be accessible via http and all that "handler" business.

So if somebody more in the know could bless this solution or tell me how to really do it would be grateful. Or even point me to the correct configuration directives.

/Fredric

PS. I run on a range from 1.3 to 2.2 but the solution will only have to work for 2.2 (and newer).

begin:vcard
fn:Fredric Fredricson
n:Fredricson;Fredric
org:Ln4 Solutions AB
email;internet:Fredric.Fredricson@xxxxxxxxxxxxx
title:CTO
tel;home:+46 8 91 64 39
tel;cell:+46 70 677 58 48
version:2.1
end:vcard


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux