Uploading files to remote server running nginx 1.24 returns http status code 405 Not Allowed.
Kaushal Shriyan
kaushalshriyan at gmail.com
Sat Dec 16 13:02:44 UTC 2023
Hi,
I am running nginx version: nginx/1.24.0 on CentOS Linux release 7.9.2009
(Core). I have the below config file /etc/nginx/conf.d/upload.conf.
############################################################################################################################################
#cat upload.conf
server {
listen 443 ssl;
server_name software.example.com;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_stapling off;
ssl_stapling_verify on;
ssl_certificate /etc/letsencrypt/live/
software.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/
software.example.com/privkey.pem;
ssl_ciphers
ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
root /var/www/html/cbsoftwarebinaries;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
autoindex on;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/software.example.com/dhparam.pem;
add_header Strict-Transport-Security: max-age=63072000;
#index index.html index.htm;
location /var/www/html/cbapibankingsoftwarebinaries {
try_files $uri $uri/ =404;
}
}
server {
listen 443 ssl;
server_name software.example.com;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_stapling off;
ssl_stapling_verify on;
ssl_certificate /etc/letsencrypt/live/
software.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/
software.example.com/privkey.pem;
ssl_ciphers
ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
root /var/www/html/softwareuploads;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/software.example.com/dhparam.pem;
add_header Strict-Transport-Security: max-age=63072000;
index index.html index.php;
location = /upload.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
client_max_body_size 10M; # Adjust the maximum allowed file size
}
############################################################################################################################################
When I hit https://software.example.com I get all the files and folders as
per directory listing which is working as expected as per the below
screenshot
[image: image.png]
When I am trying to upload files by hitting
https://software.example.com/upload_form.html I am encountering http status
code 405 Not Allowed. Please find inline a screenshot for your reference.
[image: image.png]
[image: image.png]
Please guide me. Thanks in advance.
Best Regards,
Kaushal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20231216/11e62fa8/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 21924 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20231216/11e62fa8/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 19056 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20231216/11e62fa8/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 112131 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20231216/11e62fa8/attachment-0005.png>
More information about the nginx
mailing list