Nginx Permission Issues - Unable to access dynamic PHP websites

  • Hi guys,


    I want to serve a few private websites using my OMV server and installed the Nginx plugin for this cause. First, I created a new pool setting www-data as user and group, everything else is default. After that, I added a new server using a shared folder Websites I created on one of my data drives - this directory is my document root. Port-based (8080), SSL turned off, PHP turned on, beforementioned Pool is added, index.php selected.


    I know that the server is working, because I can easily view regular html files or images, but I cant use php-based projects, like for example a Grav CMS that I've setup at Websites/rec/


    If I try to access it, I get error messeges like this:

    Code
    [error] 23387#0 *7 directory index of "/srv/diskname/Websites/rec/" is forbidden, client: 192.168.178.20, server: , request: "GET /rec/ HTTP/1.1", host: "nas:8080"


    and

    Code
    [error] 25342#0: *3 open() "/srv/diskname/Websites/rec/de/" failed (2: No such file or directory), client: 192.168.178.20, server: , request: "GET /rec/de/ HTTP/1.1", host: "nas:8080"

    When that last error occured, it kind of seemed to work, as I saw a static 404 error page in the design of my installed Grav theme and it also redirected me to /rec/de, but it doesn't seem to be able to dynamically load and process the actuall files.




    It doesn't work either, if i manually change the owner and group to all files and folders (incl. the document root) to www-data and grant full 777 access manually using ACL in the web gui after uploading all the files.


    I guess the problem is, that the server uses www-data as user and group, whereas when I upload data to the directory on the server via samba, the owner of these files is the user-account uploading them and the group is "users". When I use SFTP, it is root and www-data


    phpinfo() works though.


    What is the recommended way to handle this?


    Thanks in advance!

  • Alright, just a quick update - I needed three things to get Grav working.


    1) Adjust nginx.conf for the webserver instance based on this config. Although I guess it will revert every time i restart the webserver or OMV, am I right?


    2) Move Grav to the root dir. It didn't work in a subfolder, even if I adjusted the conf accordingly.


    3) I had to remove the noexec option from the mounted drive with the share in /etc/openmediavault/config.xml because that prevented Grav's scripts from being executable.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!