Folder Permissions for WordPress Installation

Tiempo de lectura: 2 minutos

Today we are going to indicate the necessary permissions in a WordPress installation with Apache.

To ensure the security and proper functioning of your WordPress site within a Docker container, it is important to set the correct permissions on the web directory (www). Here is a general recommendation on how you could set the permissions:

Owner and Group: Ensure the directory owner and group are the same user as the web server inside the Docker container. Typically, this user is www-data.
Write Permissions: You should only grant write permissions to the web directory to files and directories that WordPress actually needs to modify. This includes the wp-content/uploads and wp-content/plugins directories if you plan to install plugins directly from the WordPress admin panel.
Read and Execute Permissions: All files and directories must have read and execute permissions for the web server. This will ensure that the server can access and serve the website files correctly.

To set these permissions, you can use the chmod command on your host operating system. For example:

# Cambiar propietario y grupo del directorio web a www-data
sudo chown -R www-data:www-data /ruta/al/directorio/www

# Establecer permisos de escritura en los directorios necesarios
sudo chmod -R 775 /ruta/al/directorio/www/wp-content/uploads
sudo chmod -R 775 /ruta/al/directorio/www/wp-content/plugins

# Establecer permisos de lectura y ejecución en todos los archivos y directorios
sudo chmod -R 755 /ruta/al/directorio/www

Make sure to replace /path/to/www/directory with the actual location of the web directory on your system. Also, note that these commands grant write and execute permissions quite liberally. If you have additional security concerns, you could adjust these permissions according to your specific needs.

Leave a Comment