XF 2.2 externalDataPath / externalDataUrl

MattW

Well-known member
I'm testing using an NFS mount point for data / internal_data. I can get everything working, apart from the /data part.

Code:
$config['internalDataPath'] = '/mnt/internal_data';
$config['externalDataPath'] = '/mnt/data';
Using those, I get a 404 on the files that are located in /data, so I'm assuming the externalDataUrl setting is also required.

Does that need to be something on a different URL, or can XF not map the data mount point correctly? The attachments are correctly uploaded (full size image loads, just the thumbnail doesn't), but it's there in the NFS /data mount point.

Cheers,
 
You do not need externalDataUrl if the webserver can still access the files if requested via https://forum.tld/data/...

How you achive that is up to you (different document root, bind-mount, symlink, proxy, ... endless possibilites :).
Well that's what I thought, and the web server can access both the new /data and /internal_data folders, as the files are being uploaded there (with correct user and permissions set). But they going direct to the data URL for the thumbnail returns a 404. I'll double check I'm not missing something with Litespeed.
 
Code:
[3620505] [T0] [162.158.91.129:62850:HTTP2-11#DOMAIN] File not found [/home/DOMAIN/public_html/data/attachments/23/23504-14636faaba7c34ca135e4bd177c840a0.jpg]
So it's still looking in the document root, so I guess I'm just missing something as I thought it would just work, but guess it needs one of the methods to actually link it?
 
Well, as I said before:
The webserver still needs to be able to find the files in /data - how you achieve that is up to you:
  • You could define a different root (if using nginx, don't know for other webservers)
  • You could bind-mount /mnt/data to /home/DOMAIN/public_html/data
  • You could use a symlink (if the webserver can follow that)
  • You could use a reverse proxy for location /data
  • You could rewrite /data to aother location and use a different root there (with nginx)
  • You could rewrite the requests, route them through XenForo, read the files via PHP and output them to the browser (really, really, really bad idea - but possible)
  • ....
If you just change config.php, XF / PHP will read & write files from there (if it can) but the Webserver has no idea that the files are now somwhere else.
 
Last edited:
Why not just set externalDataUrl ?
Why change it if it is not necessary? ;)

Changing the URL can have various undesired side effects:
  1. It invalidates all caches
  2. It requires recrawling all content that was in /data
  3. Might cause loss of organic image traffic (especially if moved to a different domain)
  4. Might cause broken images if users posted thumbs via [img]
  5. Might cause broken links, for example if users linked to uploaded videos
  6. ...
 
bind mount on /mnt/data to my data directory sorts the issue, however, if I'm doing this, surely it then negates the requirement for the config variables, and I could just bind mount the internal_data directory as well?
 
Top Bottom