I have a normal PHP script listening for $_SERVER["REQUEST_METHOD"] and I do the form submission using the PUT method, but I get error 405 on the nginx server.
Just want to submit a simple form using request methods.
1 server {
2
3 listen 80; # port 80 default
4
5 root /home/user/workspace/l; # default directory where the files will be stored and served from
6
7 index index.php index.html index.htm; # index defined to be served under directory
8
9 server_name l; #name of the virtual host or domain
10
11 error_log /var/log/nginx/l.error.log;
12 access_log /var/log/nginx/l.access.log;
13
14
15 location / {
16 try_files $uri $uri/ /index.html;
17 }
18
19 # Serve PHP scripts to FastCGI server our php-fpm server listening on 127.0.0.1:9000
20
21 location ~ \.php$ {
22 fastcgi_pass 127.0.0.1:9000;
23 # With php5-fpm:
24 #fastcgi_pass unix:/var/run/php5-fpm.sock;
25 fastcgi_index index.php;
26 fastcgi_split_path_info ^(.+\.php)(/.*)$;
27 include fastcgi_params;
28 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
29 }
30 }
The request call is /index.php?groups
The initial call was:
function updateGroup(group_name, group_id) {
values = {};
values.name = group_name;
values.id = group_id;
$.ajax({
url: '?groups',
type: 'PUT',
data: values,
success: success,
dataType: 'json'
});
}