0

When uploading a site logo, I get a 403 Forbidden HTTP error.

Also, the Inspect Element preview shows this page:

enter image description here

On the site itself, it just says "http error". I tried disabling nonces, no change. I had done chmod -R 750 <web root dir> and chown -R www-data:www-data <web root dir> too, so I assume permissions are not the issue. (Yes, php-fpm and my web server are running as www-data.)

This is a default install from Wordpress stable version. I have removed my plugins folder too, no change. My web server is NGINX.

0

A few things come in mind

  • have you checked nginx access/error log? Depending on your distro, log should be located at /var/log/nginx/access.log and /var/log/nginx/error.log.
  • What role is your current WP user when uploading, does it have required capabilities ?
  • Try to change wp-content permission to 755
  • Are you having difficulties only with images file? If so, might be related to Imagick, try setting GD as default image editor. Add this next filter to default to GD in your functions.php. It will return GD before Imagick. The link provided is a plugin doing just that.

.

add_filter( 'wp_image_editors', 'change_graphic_lib' );

function change_graphic_lib($array) {
  return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}
2
  • It's the admin user(fresh install), all nginx says is 403 Forbidden. I tried changing the permission, no change. It happens with any upload, regardless of file type. Aug 16 '16 at 0:06
  • hum it's really odd! are you in control of nginx server blocks? if so maybe this would be useful information you could edit your question with, as maybe nginx is doing some kind of wrong proxying of php requests
    – bynicolas
    Aug 16 '16 at 0:10
0

So after a good bit of debugging around, I discovered it was that posting over 64 KB(16-bit integer length) of data would cause my modified NGINX to not split up post data in FCGI. After fixing that, it working great.

1
  • so it was indeed nginx not handling requests correctly. Glad you figured it out!
    – bynicolas
    Aug 16 '16 at 3:04

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.