Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding servers to nginx? (SOLVED)

Featured Replies

I have a docker image running on my unraid server. I would like to reverse proxy it through the existing nginx instance that is serving up the unraid website. Although I have managed the changes required to the nginx config file, obviously it is overwritten every time the unraid server reboots. Is there any supported way I can persist this so that it survives reboots?

Edited by Scott B
marking as solved

  • Community Expert

 

  • Community Expert

 

  • Author

Thanks for the reply. I see that the link you provided will create a new docker network and another separate nginx instance. This is definitely an option - just curious if it is the only option? The only reason we can't use the existing nginx installation is due to the configuration file being erased at reboot. I have tested creating an nginx configuration and it does work if you restart nginx.

  • Author

I solved the problem, and once I found the right plugin it was pretty easy! The docker image I am working with is Technitium DNS

  1.  I set the docker container network to "host"

  2. I installed CA User Scripts and created a new user script called enable-nginx-extensions with the following:

    #!/bin/bash
    # remove the config file if it already exists
    rm /etc/nginx/conf.d/nginx_extend.conf
    # symlink to the config file stored on the boot volume with the user script
    ln -s /boot/config/plugins/user.scripts/scripts/enable-nginx-extensions/nginx_extend.conf /etc/nginx/conf.d/
    # restart nginx so that the new configuration file is picked up
    /etc/rc.d/rc.nginx restart

     

  3.  I created a configuration file and stored it at /boot/config/plugins/user.scripts/scripts/enable-nginx-extensions/nginx_extend.conf

    server {
            listen 80;
            server_name new_server_name.local;
            location / {
                    proxy_pass http://localhost:5380/;
                    allow all;
            }
    }

    A couple of things to take note of:

    1. You must specify a server name - unraid is the default server and you can't change that. it has to be that way. Don't fight it :)

    2. Set the proxy_pass line to the ip/port where the upstream server is serving your application

    3. The allow all line is very important - without it, the application will try to authenticate the user against the unraid auth. This is almost certainly not what you want.

  4. I set the script to run at array start.

  5. I verified that my new site was available and restarted things a couple of times to make sure it persisted.

I hope these steps help someone else out in the future!

Edited by Scott B
Fixed comment in the script and updated steps in comment to be more accurate

  • Scott B changed the title to Adding servers to nginx? (SOLVED)
  • 3 years later...
On 1/25/2021 at 12:02 PM, Scott B said:

I solved the problem, and once I found the right plugin it was pretty easy! The docker image I am working with is Technitium DNS

  1.  I set the docker container network to "host"

  2. I installed CA User Scripts and created a new user script called enable-nginx-extensions with the following:

    #!/bin/bash
    # remove the config file if it already exists
    rm /etc/nginx/conf.d/nginx_extend.conf
    # symlink to the config file stored on the boot volume with the user script
    ln -s /boot/config/plugins/user.scripts/scripts/enable-nginx-extensions/nginx_extend.conf /etc/nginx/conf.d/
    # restart nginx so that the new configuration file is picked up
    /etc/rc.d/rc.nginx restart

     

  3.  I created a configuration file and stored it at /boot/config/plugins/user.scripts/scripts/enable-nginx-extensions/nginx_extend.conf

    server {
            listen 80;
            server_name new_server_name.local;
            location / {
                    proxy_pass http://localhost:5380/;
                    allow all;
            }
    }

    A couple of things to take note of:

    1. You must specify a server name - unraid is the default server and you can't change that. it has to be that way. Don't fight it :)

    2. Set the proxy_pass line to the ip/port where the upstream server is serving your application

    3. The allow all line is very important - without it, the application will try to authenticate the user against the unraid auth. This is almost certainly not what you want.

  4. I set the script to run at array start.

  5. I verified that my new site was available and restarted things a couple of times to make sure it persisted.

I hope these steps help someone else out in the future!

 

This doesn't work for me. I don't think that the files in `/etc/nginx/conf.d/` are automatically being picked up. Am I missing something? 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.