r/openbsd • u/Yokohamanta • 7d ago
Multimedia server inside a chroot environment
I understand that, by default, OpenBSD's http daemon (httpd.conf) runs in a chroot environment (/var/www). However, what I do not understand is why this is causing PHP hangups when I try to upload something to my Wordpress media folder. In addition, audio files (.m4a, .mp3) that are referenced by HTML5 pages throw an error when I try to play them ...
Basically, my question is: what do I need to do with my server configuration to allow the web server to properly handle these files. I would like to be able to use PHP and am wondering if I need to create a directory for it within the chroot directory (/var/www) for it to work.
Any useful guides on this are appreciated. I am relatively new to OpenBSD.
9
u/well_shoothed 7d ago
Logs would be awesome right about now...
As would your current
httpd.confMy crystal ball is in the shop for a pre-Thanksgiving tune up.
2
u/SaturnFive 7d ago
Placing the files in the chroot would be the simplest option if you want to continue using the stock
httpd. For larger amounts of data you may even want to create a dedicated/var/www/partition of the appropriate size.It's been a while since I've used PHP on OpenBSD, so perhaps there are other options if you're using
php-fpmor maybephp.inican be configured to be compatible with the chroot - not sure off the top of my head.2
u/TheRealLazloFalconi 6d ago
You might not be asking the right questions here. PHP should run inside the HTTP chroot, so as far as your web server knows, the chroot might as well not exist. This might not be true if you manually installed PHP, but if you got it from ports or pkg, it should be correct.
The problem is likely that whatever user php is running as doesn't have permission to write to the directory Wordpress wants to upload your files to. I don't recall if php has its own user or if it runs as www, but in either case, make sure that user is part of the www group and that the file in question has g+w. Adjust this advice as necessary if you use different user/group names.
On your second question, httpd probably doesn't know how to serve those files. See TYPES in
httpd.conf(5). I think you need to addaudio/m4a m4aandaudio/mpeg mp3.1
u/[deleted] 7d ago
What exactly is a 'php hangup'? Can you tell more about what happens? Does the same happen when you transfer a file via scp? Does the same happen when you run iperf? I had a wlan card which crashed when there was a lot of traffic this showed: rtwn0: device timeout in dmesg. Does you dmesg show anything when it happens?