Sign inSign up

heyfworld/openlitespeed-chown-fixed

By heyfworld

•Updated about 1 month ago

Image
0

2.7K

heyfworld/openlitespeed-chown-fixed repository overview

⁠OpenLiteSpeed Permission Fix

A custom OpenLiteSpeed Docker image that fixes the common file permission mismatch between OpenLiteSpeed worker processes (nobody) and website files (www-data). Drop-in replacement for litespeedtech/openlitespeed:latest.

⁠What It Does

OpenLiteSpeed's default worker processes run as nobody:nogroup, but PHP applications (WordPress, Laravel, etc.) expect files owned by www-data. This causes permission denied errors on plugin installs, file uploads, cache writes, and updates.

This image reconfigures OpenLiteSpeed to run workers as www-data:www-data and fixes file permissions automatically on every container start.

⁠Dockerfile

FROM litespeedtech/openlitespeed:latest

# Switch OpenLiteSpeed workers from nobody → www-data
RUN sed -i 's/user\s*nobody/user                     www-data/' /usr/local/lsws/conf/httpd_config.conf && \
    sed -i 's/group\s*nogroup/group                    www-data/' /usr/local/lsws/conf/httpd_config.conf

# Fix ownership on OLS working directories
RUN chown -R www-data:www-data /usr/local/lsws/logs /usr/local/lsws/tmp && \
    chown -R www-data:www-data /var/www/vhosts

# Inline entrypoint: fix permissions on every start, then exec the original entrypoint
COPY <<'EOF' /fix-permissions.sh
#!/bin/bash
chown -R www-data:www-data /var/www/vhosts
find /var/www/vhosts -type d -exec chmod 755 {} \;
find /var/www/vhosts -type f -exec chmod 644 {} \;
exec "$@"
EOF

RUN chmod +x /fix-permissions.sh

ENTRYPOINT ["/fix-permissions.sh"]
CMD ["/entrypoint.sh"]

⁠Quick Start

# docker-compose.yml
services:
  litespeed:
    image: heyfworld/openlitespeed-chown-fixed:latest
    container_name: litespeed
    volumes:
      - ./sites:/var/www/vhosts
    ports:
      - "80:80"
      - "443:443"
      - "7080:7080"
docker compose up -d

⁠What This Fixes

  • ✅ WordPress plugin & theme installs
  • ✅ File uploads and media management
  • ✅ Cache and temporary file creation
  • ✅ WordPress core & plugin updates
  • ✅ Log file writing

⁠Verify

# Confirm workers run as www-data
docker exec litespeed ps aux | grep lshttpd

# Check file ownership
docker exec litespeed ls -la /var/www/vhosts/

# Check config
docker exec litespeed grep -E "user|group" /usr/local/lsws/conf/httpd_config.conf

⁠Security

Standard file permissions are enforced — 755 for directories, 644 for files. No chmod 777. The image only changes the process user from nobody to www-data, following OpenLiteSpeed best practices for non-root operation.

Tag summary

Content type

Image

Digest

sha256:25bc3a8b2…

Size

242.7 MB

Last updated

about 1 month ago

docker pull heyfworld/openlitespeed-chown-fixed