I have strange situation...my permalinks not work after setup nginx to work with apache.

permalinks work if they not finish with ".html", but work if finish with "/"

ie.: this work: justflick.com/new-the-dark-knight-rises-set-photo-2012-01-25.html/tom-hardy-as-bane-in-the-dark-knight-rises

but this don't: justflick.com/new-the-dark-knight-rises-set-photo-2012-01-25.html

here is my confog for nginx for this site.

 server {

  access_log off;

  error_log  /etc/nginx/logs/vhost-error_log warn;
  listen    80;
  server_name  justflick.com www.justflick.com;

  # uncomment location below to make nginx serve static files instead of Apache
  # NOTE this will cause issues with bandwidth accounting as files wont be logged
  location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css)$ {
   root   /home/justflic/public_html;

  location / {
   client_max_body_size    10m;
   client_body_buffer_size 128k;

   proxy_send_timeout   90;
   proxy_read_timeout   90;

   proxy_buffer_size    4k;
   # you can increase proxy_buffers here to suppress "an upstream response
   #  is buffered to a temporary file" warning
   proxy_buffers     16 32k;
   proxy_busy_buffers_size 64k;
   proxy_temp_file_write_size 64k;

   proxy_connect_timeout 30s;


   proxy_set_header   Host   $host;
   proxy_set_header   X-Real-IP  $remote_addr;
   proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

1 Answer 1


It isn't working because Nginx tries to serve the permalink as a static file. At the moment the current configuration doesn't allow HTML files to be passed to Apache. Please remove the "html" part from the following block so that the permalinks are passed to Apache...

location ~* .(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css)$ { root /home/justflic/public_html; }

Once you remove the html, it should look like the following...

location ~* .(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|js|css)$ { root /home/justflic/public_html; }

Hope this helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.