403 Error on all files in Upload folder after update

Hi, after updating the new local WP version Version 8.2.1+6583 today, the website I am working on is not working anymore.

All files the Website is trying to load on the websites are getting a 403 Forbidden nginx/1.16.0 error.

These files are all in the upload folder.

I can see all my images fonts, etc. in the WP dashboard.

What I tried to troubleshoot is
-checking permissions for the folders - everything OK
-Deactivate/Activate all plugins and themes. - didn’t work
-Made A backup and installed it in another hosting environment - didn’t work

So I am clueless about what is going on and I am hoping that someone can help me out here.

Thanks in advance!

Here are more additional info:

What version of Local are you using? Version 8.2.1+6583
What Operating System and OS version is being used? Microsoft Windows 11 Pro

Can you please provide your Local Log?
local-lightning.log (18.2 KB)

Does this happen for all sites in Local, or just one?
No, just one site
Are you able to create a new, plain WordPress site?
Yes.


Hi @noelforemgen

What about if you downgrade back to the previous version of Local does that work?

Made A backup and installed it in another hosting environment - didn’t work

Do you mean you uploaded the site to a host or different developer application? Or did you try cloning or re-importing the site into Local?

1 Like

Hi Nick-B,

Thanks for your reply

What about if you downgrade back to the previous version of Local does that work?

I tried that as well, but it didn’t work out.

Do you mean you uploaded the site to a host or a different developer application? Or did you try cloning or re-importing the site into Local? I made a copy with All-in-One WP Migration and installed it on a shared hosting account. But the error is the same as on Local WP.

On local, I made a fresh WP install and imported the site on it. But the error is the same…

So I am quite clueless at this point about what I should try next…

Do you have any antivirus, security, or firewall applications that could be blocking Local?

Are you running other developer applications simultaneously? Apps like MAMP, XAMPP, or Docker for example.

If you create a new, blank site in Local can you access that okay? If you can, then you may want to try reimporting the site with our manual import steps here:

Manually Import a Local Site

1 Like

Do you have any antivirus, security, or firewall applications that could be blocking Local? I have one antivirus running. I tested turning off the antivirus but it didn’t resolve the problem.

Are you running other developer applications simultaneously? Apps like MAMP, XAMPP, or Docker for example. Nope, just Local WP.

If you create a new, blank site in Local can you access that okay? If you can, then you may want to try reimporting the site with our manual import steps here: Yeah, a fresh install is working. I will test the manual import and will see how it works and will report back to you after trying it.

Thanks for the tip!

1 Like

I tried to import the site manually but I am getting this error when trying to import the SQL database.

Not sure, what it means as I have little knowledge about server SQL etc.

Hi @noelforemgen -

Is this possibly a mixed content issue? Are those images loading over http:// instead of https://?

I see in your admin bar that you are using Bricks - is there any caching happening in that tool that you can clear? What does that “Automate CSS” do?

Thanks!
Sam

Hi Sam,

Is this possibly a mixed content issue? Are those images loading over http:// instead of https://?

Nope. Before I upload any files, I install the SLL certificate. But anyway, I tested both HTTP versions and deactivated the certificate as well. - didn’t work as well

I see in your admin bar that you are using Bricks - is there any caching happening in that tool that you can clear? What does that “Automate CSS” do?

Yes, I am using Bricks Builder on that page. All caching is deactivated. Automatic CSS generates CSS stylesheets with variables.

But the theme and the plugins are not the root of the problem. I deactivated all (themes and plugins), but no images are loading.

It has something to do with the URLs. But I can not define where it comes from. I changed between Apache and Nginx and used different PHP versions. So I guess that there is something messed up in the SQL database.

It is interesting that on Local WP I am getting a 403 error for all images, but when I am uploading the site to a hosting account the error becomes a 404.

I am not sure where to investigate more. I guess that I will need to hire an expert for server development and SQL.

Thanks,
Noel

1 Like

Hello @noelforemgen -

Thank you for bearing with us as we try to get to the bottom of your issue.

Can you try the following and let us know what the result is?

  • Start the site in Local
  • Open a site shell
  • Runn cd wp-content/uploads to get to the uploads directory
  • Runn ls -l to list all files and permissions

Thank you,

Sam

Hi Sam,

Thanks for following up. The 2nd command doesn’t seem to work. I am getting the following error message.

The command “ls” is either misspelled or
could not be found.

But I checked the file permissions.
For directories, it is 777 and for the media files it is 666.

Thanks

This is an odd one… thanks for sticking with us!

Based on the file permissions being correct, it points to an issue with the nginx configuration and how those files are being served. Can you share us the error.log file for nginx? You can click “Go to site folder” and then navigate here:

2 Likes

Hi Austin,

Thanks for caring about my problem.

Sure. Here is the file.

error.log (1.7 MB)

Thanks @noelforemgen – That error log does help to confirm that nginx is having trouble accessing those file, for example this line:

2024/02/04 15:42:36 [error] 33184#33376: *1387 CreateFile() "C:/Users/noelf/Local Sites/therealworldblueprint/app/public/wp-content/uploads/metropolis.black-webfont.woff" failed (5: Access is denied), client: 127.0.0.1, server: , request: "GET /wp-content/uploads/metropolis.black-webfont.woff HTTP/1.0", host: "therealworldblueprint.local", referrer: "https://therealworldblueprint.local/"

The CreateFile() part is a windows-specific message. When combined with the (5: Access is denied) error, it basically tells us that nginx doesn’t have the correct permissions to access that file.

Before going too much farther with troubleshooting, I want to verify – have you rebooted the computer at all since these things have happened? I ask because it’s possible that some other process is holding on to those files and preventing subsequent connections to them. If you haven’t done a hard rebooted, do so now.

Next, if that doesn’t help, you mentioned checking the file permissions and that they were 777 for folders and 666 for files. How did you go about verifying that information? Because this is Windows, I don’t think that the permissions model exactly mimic what’s in a Unix environment.

For these files that are having issues, can you navigate to them within Window’s file explorer and then right-click and select “Properties” – what do those permissions show you?

Additionally, since the error log is for the nginx process, we can think of it saying “nginx doesn’t have permission to access this file.”

Because of this, I’m curious about what Local’s running nginx process is. I think these steps should help with getting more details about nginx and the permissions it has when accessing one of these files:

  1. Open Task Manager by pressing Ctrl + Shift + Esc or by right-clicking on the taskbar and selecting “Task Manager”.
  2. In Task Manager, go to the “Details” tab.
  3. Look for the process name related to nginx service. It may be “nginx.exe” or something similar.
  4. Once you have identified the nginx process, note down its Process ID (PID).

Next, to check the permissions:

  1. Open an elevated Command Prompt. Right-click on the Start button and select “Command Prompt (Admin)”.

  2. In the command prompt, run the following command to get the list of open handles of the nginx process:

    handle -p <PID> -a
    

    Replace <PID> with the process ID obtained from Task Manager.

  3. Look for the file (for example, “metropolis.black-webfont.woff”` or the corresponding path mentioned in the error log in the output of the command.

  4. The handle information should include the process name and the file handle permissions.

Let us know what you find while investigating!

1 Like

Hi Ben,

Thanks for your support.

Yes, I rebooted the computer several times.

About how I checked the file permissions. As I don’t have a cpanel or something similar I downloaded an app in Wordpress called File Manager to check the file permissions directly in WP.

When I uploaded the site to a hosting company, I rechecked the file permissions, and there the file permissions changed to 755 for folder permissions and 644 for file permissions. What is interesting is that the error is changing as well on a hosting environment. It changes from a 403 error to a 404.

I can access all files and open them in the wp-upload folder.

After identifying the PID (2 processes were open for nginx.exe) With administrator rights, I tried to run the command line you sent me. Unfortunately, it is just giving me an error message saying (in English) “The command “handle” is either misspelled or could not be found.”

I don’t know anything about this stuff but maybe I am in the wrong folder to run the command.

Thanks

hey @noelforemgen

I’m starting to wonder if this isn’t a process or software issue, but maybe a content issue?

You mention that when this site is pushed remotely, you receive a 404 error instead of a 403.

I took a closer look at your original screenshot and notice a colon with a one at the end of those urls:

Zight 2024-04-11 at 10.45.57 AM.jpg

Is there a way you can edit the content that references those various assets and ensure that there isn’t a :1 at the end of them?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.