Nginx reverse proxy install: 403's for static resources

The overall setup has been smooth. I am just experiencing 403 errors from what appears to be the static resources directory.

This is the static conf in Nginx. (https is also set-up)

location ~ ^/(css|img|js|fonts)/ {
        root /home/writefreely/writefreely/static;
}

Is it because the app is running in the home directory for this dedicated user?

I also tried giving the www-data group access to the static resources folder. But no luck.


  • Ubuntu 22.04 vps fresh install.
  • Current Write Freely Build
1 Like

Can you run the following command in the /home/writefreely/writefreely directory and share the output?

ls -l

I’m guessing this is due to file permissions.

Hey, currently it is this:

-rw-rw-r-- 1 writefreely writefreely 2.3K Jan  4 14:32 config.ini
drwxrwxr-x 2 writefreely writefreely 4.0K Jan  4 11:49 keys
-rwxrwxr-x 1 writefreely writefreely  42M Nov 11 07:51 writefreely
drwxrwxr-x 2 writefreely writefreely 4.0K Nov 11 07:51 pages
drwxr-xr-x 7 writefreely writefreely 4.0K Nov 11 07:51 static
drwxrwxr-x 4 writefreely writefreely 4.0K Nov 11 07:51 templates

In the meantime I have disabled the above static file configuration in nginx and everything works fine (of course with a hypothetical performance hit)

and I have also tried with www-data:www-data and writefreely:www-data

Same problem here.

Fresh Ubuntu 22.04 install. I’ve got Writefreely working, but all assets are not working. All giving 403 errors.

writefreely is the owner of /srv/writefreely and below … all the files have 755 permissions. But all are generating 403’s.

i.e.

root@WriteFreely:~# ls -lR /srv/writefreely/insight.futurist.info/static |more
/srv/writefreely/insight.futurist.info/static:
total 28
drwxr-xr-x 3 writefreely writefreely 4096 Apr 22 2020 css
-rwxr-xr-x 1 writefreely writefreely 6090 Apr 22 2020 favicon.ico
drwxr-xr-x 2 writefreely writefreely 4096 Apr 22 2020 fonts
drwxr-xr-x 4 writefreely writefreely 4096 Apr 22 2020 img
drwxr-xr-x 4 writefreely writefreely 4096 Apr 22 2020 js
drwxr-xr-x 2 writefreely writefreely 4096 Apr 22 2020 less

/srv/writefreely/insight.futurist.info/static/css:
total 76
-rwxr-xr-x 1 writefreely writefreely 2079 Apr 22 2020 fonts.css
-rwxr-xr-x 1 writefreely writefreely 709 Apr 22 2020 icons.css
drwxr-xr-x 2 writefreely writefreely 4096 Apr 22 2020 lib
-rwxr-xr-x 1 writefreely writefreely 10801 Apr 22 2020 prose.css
-rwxr-xr-x 1 writefreely writefreely 53235 Apr 22 2020 write.css

/srv/writefreely/insight.futurist.info/static/css/lib:
total 8
-rwxr-xr-x 1 writefreely writefreely 794 Apr 22 2020 atom-one-light.min.css
-rwxr-xr-x 1 writefreely writefreely 600 Apr 22 2020 mono-blue.min.css

/srv/writefreely/insight.futurist.info/static/fonts:
total 2292
-rwxr-xr-x 1 writefreely writefreely 79682 Apr 22 2020 Lora-Bold.eot
-rwxr-xr-x 1 writefreely writefreely 193408 Apr 22 2020 Lora-Bold.ttf
-rwxr-xr-x 1 writefreely writefreely 85388 Apr 22 2020 Lora-Bold.woff
-rwxr-xr-x 1 writefreely writefreely 68656 Apr 22 2020 Lora-Bold.woff2
-rwxr-xr-x 1 writefreely writefreely 76753 Apr 22 2020 Lora-Italic.eot
-rwxr-xr-x 1 writefreely writefreely 183684 Apr 22 2020 Lora-Italic.ttf
-rwxr-xr-x 1 writefreely writefreely 81992 Apr 22 2020 Lora-Italic.woff
-rwxr-xr-x 1 writefreely writefreely 66684 Apr 22 2020 Lora-Italic.woff2
-rwxr-xr-x 1 writefreely writefreely 73724 Apr 22 2020 Lora-Regular.eot
-rwxr-xr-x 1 writefreely writefreely 175528 Apr 22 2020 Lora-Regular.ttf
-rwxr-xr-x 1 writefreely writefreely 78928 Apr 22 2020 Lora-Regular.woff
-rwxr-xr-x 1 writefreely writefreely 63668 Apr 22 2020 Lora-Regular.woff2
-rwxr-xr-x 1 writefreely writefreely 143258 Apr 22 2020 MaterialIcons-Regular.eot
-rwxr-xr-x 1 writefreely writefreely 281658 Apr 22 2020 MaterialIcons-Regular.svg
-rwxr-xr-x 1 writefreely writefreely 128180 Apr 22 2020 MaterialIcons-Regular.ttf
-rwxr-xr-x 1 writefreely writefreely 78776 Apr 22 2020 MaterialIcons-Regular.woff
-rwxr-xr-x 1 writefreely writefreely 42304 Apr 22 2020 MaterialIcons-Regular.woff2
-rwxr-xr-x 1 writefreely writefreely 18866 Apr 22 2020 open-sans-v13-latin-700.eot
-rwxr-xr-x 1 writefreely writefreely 106665 Apr 22 2020 open-sans-v13-latin-700.svg
-rwxr-xr-x 1 writefreely writefreely 35924 Apr 22 2020 open-sans-v13-latin-700.ttf
-rwxr-xr-x 1 writefreely writefreely 21028 Apr 22 2020 open-sans-v13-latin-700.woff
-rwxr-xr-x 1 writefreely writefreely 16276 Apr 22 2020 open-sans-v13-latin-700.woff2
-rwxr-xr-x 1 writefreely writefreely 18233 Apr 22 2020 open-sans-v13-latin-regular.eot
-rwxr-xr-x 1 writefreely writefreely 107279 Apr 22 2020 open-sans-v13-latin-regular.svg
-rwxr-xr-x 1 writefreely writefreely 34156 Apr 22 2020 open-sans-v13-latin-regular.ttf
-rwxr-xr-x 1 writefreely writefreely 20248 Apr 22 2020 open-sans-v13-latin-regular.woff
-rwxr-xr-x 1 writefreely writefreely 15572 Apr 22 2020 open-sans-v13-latin-regular.woff2

Are you using WriteFreely as the public-facing server here, or are you using a reverse proxy like nginx?

Reverse proxy.

I fixed it. Had to chmod a+x to all the files / directories. That could be clearer in the docs.

Hmm, it looks like they already all had that permission though? Was there anything else you might’ve done to make it work?

Files shouldn’t be +x (unless they’re actually shell scripts or executable binaries); only directories.

1 Like