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

Method #2

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:

  1. 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.

  2. Set the ownership of the /xibo/ folder to the NGINX user and group. You can use the chown command to do this:

    bash
    sudo chown -R www-data:www-data /path/to/xibo

    This command recursively sets the ownership of the /xibo/ folder and all its contents to the www-data user and group.

  3. Set the appropriate permissions on the /xibo/ folder to allow NGINX to write to it. You can use the chmod command to do this:

    bash
    sudo chmod -R 775 /path/to/xibo

    This command recursively sets the permissions on the /xibo/ folder and all its contents to rwxrwxr-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

Most Popular

Remove Unicode Zero Width Space PHP

PhpStorm, return value is expected to be 'A', 'object' returned

Laravel file upload returns forbidden 403, file permission is 700 not 755