Posted January 25, 20214 yr 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 January 25, 20214 yr by Scott B marking as solved
January 25, 20214 yr 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.
January 25, 20214 yr 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 I set the docker container network to "host" 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 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: 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 Set the proxy_pass line to the ip/port where the upstream server is serving your application 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. I set the script to run at array start. 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 January 26, 20214 yr by Scott B Fixed comment in the script and updated steps in comment to be more accurate
July 9, 20241 yr 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 I set the docker container network to "host" 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 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: 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 Set the proxy_pass line to the ip/port where the upstream server is serving your application 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. I set the script to run at array start. 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.