Install Nginx and MySQL on OMV 5

  • I have OMV 5.5.12-1 Installed on Raspberry Pi 3B

    I have OMV-Extras Plug installed


    I would like to install Nginx or Apache, PHP and MySQL for development purposes


    I have spent hours watching videos - none of which give me any clues. Most of them just say to install it from the plugins menu, but it's not there.


    Can someone please explain how to install Nginx/Apache, PHP and MySQL please?


    Go easy on me :)

  • molmagman

    Changed the title of the thread from “Install Nginx and MySQL om OMV 5” to “Install Nginx and MySQL on OMV 5”.
  • So this is what I've done.

    • Changed OMV Web-admin port to 81
    • Installed Docker from OMV-Extras Panel
    • Enabled SSH
    • Logged into server using Putty
    • Run 'docker ps'
    • This tells me there are no docker containers
    • Run 'docker run --name mynginx1 -p 80:80 -d nginx'
    • Image not found
    • Image is pulled from library/nginx
    • Nginx installed
    • Browsed to 'mediavault'
    • Nginx welcome page

    So, that was easy so far.


    Questions

    1. How does docker know where to download nginx from? Is there a list somewhere?
    2. How can I see the list of docker containers in the web interface
    3. How can I manage Nginx - I presumed there would be a panel in OMV?
    4. What else can I install?
    5. How do I remove the docker container?
    6. How do I add PHP and MySQL?

    Thank you.

  • How does docker know where to download nginx from? Is there a list somewhere?

    Docker always uses DockerHub when the source is not otherwise specified


    How can I see the list of docker containers in the web interface

    Portainer is used for this purpose. You can install it via OMV-extras.


    How can I manage Nginx - I presumed there would be a panel in OMV?

    No short answer here. You would need to check the container documentation.


    What else can I install?

    In docker, basically whatever you want....


    How do I remove the docker container?

    In CLI docker stop <container> && docker rm <container> or via Portainer


    How do I add PHP and MySQL?

    The easiest way would be to choose a container with it preinstalled. For this you can check out the linuxserver.io nginx image (needs SQL database in a separate container). Or search google for a tutorial for setting up a LEMP stack in docker.

  • Thanks for your help so far!

    So I can spin up an nginx and a php docker :)

    It serves files from /usr/share/nginx/html :)


    I have websites stored in folders within:

    /srv/dev-disk-by-label-storage/Websites


    So, I spin up a docker with the volumes mapped:

    Volumes: /srv/dev-disk-by-label-storage/Websites:/usr/share/nginx/html (from cockpit)


    ... and I get "403 Forbidden" :(


    When I check the logs, I see this:

    2020/10/18 17:14:03 [error] 28#28: *2 directory index of "/usr/share/nginx/html/" is forbidden, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", host: "mediavault"


    I have changed the owner of all the files in the Websites folder to www-data which I believe is the correct user for nginx.


    Please help :(

  • output of id www-data is uid=33(www-data) gid=33(www-data) groups=33(www-data)

    output of docker exec -it nginxcontainer id www-data is uid=33(www-data) gid=33(www-data) groups=33(www-data)


    So, the same :(


    Is there anything I should be doing with the container re conf files?

  • Ah - OK.

    Pulled the linuxserver nginx image with docker pull linuxserver/nginx

    Fired up a docker with option Volumes: /srv/dev-disk-by-label-storage/Websites:/config/www

    Now I can browse to my website and it works very well (couple of odd PHP issues but I'll sort those) :)


    Problem - all the files have been hijacked by user id 911 (I presume this is Nginx user now) and I can't make any changes :(


    Nearly there!

  • Yay!

    It works!


    I manually, recursively changed the owner of all the website files back to nobody:users through ssh

    Span up a linuxserver/nginx docker and mapped Volumes : /srv/dev-disk-by-label-storage/Websites:/config/www

    Set two environment variables (you can't set parameters in the command field in Cockpit)

    PUID:65534

    GUID:65534

    Browsed to the mediavault server and there it is!


    Thank you so much for your help :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!