0
Under review

nginx adding HTTP verbs, 405 method not allowed

Fabio Barone 10 years ago updated by Eugene Pankov (Project coordinator) 10 years ago 8
Not sure if this is ajenti related but I tried a lot else :)

I created a web site in the ajenti panel. It's used to run owncloud. Owncloud supports WebDAV.

I can successfully run owncloud from the web interface, that works perfectly, so the basic config works. 

However, when I try accessing owncloud through a webdav client, I get "405 method not allowed", and the access.log file shows that the client is trying to access with the OPTIONS http verb, and nginx returns 405.

I tried some tutorials and added this entry to the instance's custom configuration:

location / {
   #more stuff
   dav_access user:rw group:rw all:r;
   dav_methods PUT DELETE MKCOL COPY MOVE;
   dav_ext_methods PROPFIND OPTIONS;
}

This doesn't seem to work though, so I am wondering if nginx doesn't even get to the instance's custom config and rejects these additional methods before...

Any idea how I could enable these methods? Is there any such global config accessible through ajenti? 

Any additional hint/suggestion highly welcome.

Under review
Hi Fabio,

Put three dav_* directives into custom configuration of your Content entry, instead of general website's configuration.
Eugene, thank you for responding so fast!


Not sure I understood correctly:

In the Content section of that site's configuration I have now:
[^/]\.php(/|$) PHP FastCGI
URL pattern: [^/]\.php(/|$) Regex

and under "advanced", after your response, I added:

location [^/]\.php(/|$) {
dav_access user:rw group:rw all:r;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
}

But it still does not work. Did I do something wrong here?
You don't need to add "location {" again when adding to a Content (location actually) custom configuration - Ajenti V puts the custom configuration inside the location { }. You can always verify the generated file by hand (/etc/nginx/conf.d/<website>.conf)
Understood! 

I removed the brackets and it's now only the dav_ directives there.

But I still get 405 in my client...
Don't know if this is still ajenti related, but is there anything else I could do?

Thank you again!
Are you sure that 405 isn't coming from the PHP backend itself?
Here's the entry where I can see the 405 error:
This is from the log file of the custom nginx site:

190.71.29.231 - - [26/May/2014:13:50:27 -0400] "OPTIONS /owncloud/remote.php/webdav/ HTTP/1.1" 405 166 "-" "davfs2/1.4.6 neon/0.29.6"
seems to come from nginx doesn't it?
If your PHP app responds with any HTTP error, nginx will deliver it to client. The thing is that by default, NGINX doesn't forbid any HTTP verbs.