Allow NGINX to write to folder /xibo/*
✔ Recommended Answer
The user that the PHP-FPM pool runs as should have write permission in that directory, and that directory should be in the open_basedir
variable of PHP's configuration file.
Finally you should check out stop people uploading malicious PHP files via forms and risks of a PHP image upload form before writing your upload form.
Source: stackoverflow.com
Answered By: user2629998
To allow NGINX to write to a specific folder in PHP, such as /xibo/
, you need to ensure that the appropriate permissions are set for that folder. Here are the steps you can follow:
Determine the user and group that NGINX is running under. This can vary depending on your system configuration, but on many Linux distributions, the user and group are both set to
www-data
.Set the ownership of the
/xibo/
folder to the NGINX user and group. You can use thechown
command to do this:bashsudo chown -R www-data:www-data /path/to/xibo
This command recursively sets the ownership of the
/xibo/
folder and all its contents to thewww-data
user and group.Set the appropriate permissions on the
/xibo/
folder to allow NGINX to write to it. You can use thechmod
command to do this:bashsudo chmod -R 775 /path/to/xibo
This command recursively sets the permissions on the
/xibo/
folder and all its contents torwxrwxr-x
, which allows the owner and group to read, write, and execute files, and allows others to read and execute files.
With these permissions set, NGINX should now be able to write to the /xibo/
folder as needed. Note that allowing write access to a folder can be a security risk, so be sure to restrict access as much as possible and avoid giving write permissions to any folders that do not need them.
Comments
Post a Comment