I'm using nginx with upload progress extension and some rewrite-clauses. Everything works fine, as long as my upload form uploads to a php file (<form action="myphpfile.php" ... >
). But when I use an html-file in my action parameter (<form action="myhtmlfile.htm" ...>
) I only get "({status: starting})" by requesting the upload status. But... all my pages are rewritten from htm to php using the following location-section in my nginx-conf:
location ~ \.(php|htm)$ {
rewrite ^/([a-zA-Z0-9]+).htm$ /index.php?page=$1 last;
client_max_body_size 0;
include /etc/nginx/fastcgi_params;
track_uploads uploads 30s;
}
Is there anything wrong with my location- or rewrite-clause? But... these combination works for anything else, thus I'm currently a bit confused why I only get the correct status by using php-files in form's action-parameter.
Edit: My full configuration is as follows:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
upload_progress uploads 1m;
server {
listen 80;
server_name localhost;
server_name_in_redirect off;
client_header_timeout 800;
client_body_timeout 800;
location ~* ^.+.(css|js|ico|txt|png|jpg)$ {
access_log off;
expires 30d;
root /var/www;
}
location ~ \.(php|htm)$ {
rewrite ^/([a-zA-Z0-9]+).htm$ /index.php?page=$1 last;
client_max_body_size 0;
include /etc/nginx/fastcgi_params;
track_uploads uploads 30s;
}
location = /progress.htm {
report_uploads uploads;
}
location ~ /([a-zA-Z0-9]+) {
include /etc/nginx/fastcgi_params;
}
location / {
rewrite ^ /index.htm permanent;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ /\.ht {
deny all;
}
}
}