Last active
December 27, 2018 10:53
-
-
Save fabiocicerchia/1c484a9f35a3a543612b to your computer and use it in GitHub Desktop.
Apache - PUT - 405 Method Not Allowed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} -s [OR] | |
RewriteCond %{REQUEST_FILENAME} -l [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^.+$ - [NC,L] | |
RewriteCond %{REQUEST_METHOD} (PUT|DELETE) | |
RewriteRule .* put.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@host:/var/www/test# apachectl -t -D DUMP_MODULES | |
Loaded Modules: | |
core_module (static) | |
log_config_module (static) | |
logio_module (static) | |
version_module (static) | |
mpm_prefork_module (static) | |
http_module (static) | |
so_module (static) | |
actions_module (shared) | |
alias_module (shared) | |
auth_basic_module (shared) | |
authn_file_module (shared) | |
authz_default_module (shared) | |
authz_groupfile_module (shared) | |
authz_host_module (shared) | |
authz_user_module (shared) | |
autoindex_module (shared) | |
cache_module (shared) | |
cgi_module (shared) | |
dav_module (shared) | |
deflate_module (shared) | |
dir_module (shared) | |
disk_cache_module (shared) | |
env_module (shared) | |
expires_module (shared) | |
headers_module (shared) | |
mem_cache_module (shared) | |
mime_module (shared) | |
negotiation_module (shared) | |
php5_module (shared) | |
reqtimeout_module (shared) | |
rewrite_module (shared) | |
setenvif_module (shared) | |
ssl_module (shared) | |
status_module (shared) | |
Syntax OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@host:/var/www/test# curl -vX PUT -d "whatever=whatever" http://localhost/ | |
* About to connect() to localhost port 80 (#0) | |
* Trying 127.0.0.1... | |
* connected | |
* Connected to localhost (127.0.0.1) port 80 (#0) | |
> PUT / HTTP/1.1 | |
> User-Agent: curl/7.26.0 | |
> Host: localhost | |
> Accept: */* | |
> Content-Length: 17 | |
> Content-Type: application/x-www-form-urlencoded | |
> | |
* upload completely sent off: 17 out of 17 bytes | |
* HTTP 1.1 or later with persistent connection, pipelining supported | |
< HTTP/1.1 405 Method Not Allowed | |
< Date: Fri, 18 Jul 2014 06:38:18 GMT | |
< Server: Apache/2.2.22 (Debian) | |
< Allow: GET,HEAD,POST,OPTIONS | |
< Vary: Accept-Encoding | |
< Content-Length: 313 | |
< Connection: close | |
< Content-Type: text/html; charset=iso-8859-1 | |
< | |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> | |
<html><head> | |
<title>405 Method Not Allowed</title> | |
</head><body> | |
<h1>Method Not Allowed</h1> | |
<p>The requested method PUT is not allowed for the URL /put.php.</p> | |
<hr> | |
<address>Apache/2.2.22 (Debian) Server at localhost Port 80</address> | |
</body></html> | |
* Closing connection #0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.spinics.net/lists/apache-users/msg104136.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName localhost | |
DocumentRoot /var/www/test | |
LogLevel debug | |
<Directory /var/www/test> | |
Allow from all | |
AllowOverride All | |
<Limit HEAD OPTIONS GET POST PUT DELETE> | |
Order Allow,Deny | |
Allow from all | |
</Limit> | |
<LimitExcept HEAD OPTIONS GET POST PUT DELETE> | |
Order Deny,Allow | |
Deny from all | |
</LimitExcept> | |
Script PUT /var/www/test/put.php | |
Script DELETE /var/www/test/put.php | |
</Directory> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello All,
From past 3 weeks I have been trying to upload a file from client to server, in which I have totally failed, so I tried to upload a file from my /root directory to /var/www/html/LargeFile/Download/ directory with curl.
curl -X PUT http://localhost/Download/ --upload-file abc.txt
Note: abc.txt is only present in /root and it is not present in /var/www/html/LargeFile/Download/ directory.
Output of curl:
<title>500 Internal Server Error</title>Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80
Initially I got 405 method not allowed, then after few changes I got 301 moved permanently, now I'm stuck with 500 Internal server error.
My server is Ubuntu 18.04, and apache version : Apache/2.4.18 (Ubuntu)
And I have installed php5.6
My apache2.conf is as follows:
Options FollowSymLinks
AllowOverride None
Require all denied
<Directory /usr/share>
AllowOverride None
Require all granted
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
ScriptAlias /Download /var/www/html/LargeFile/Download/
<Directory /var/www/html/LargeFile/Download>
AllowMethods GET HEAD POST PUT DELETE OPTIONS
AllowOverride
Order allow,deny
Allow from all
Require all granted
Deny from None
<Location "http://localhost/Download">
AllowMethods GET HEAD POST PUT DELETE OPTIONS
Allow from all
Require all granted
AccessFileName .htaccess
Configs on my virtual host file is as follows:
<VirtualHost *:80>
I disabled the default virtual host config and enable my virtual host config with the below command
sudo a2dissite 000-default.conf
sudo a2ensite Vhost.conf
So essentially my configs are same as you have mentioned above.
But I'm Unable to figure this out, been banging my head over it from past 3 weeks.
Can you please help me out with this.