A couple of years ago, I had a friend help me configure nginx.conf file - but he killed the global nginx.conf file, and added everything into the /etc/nginx/sites-dietpi/nginx.conf. I recently had to rebuild my dietpi install, and trying to get nginx set back up.
In my research, I see the /etc/nginx/nginx.conf holds global settings, and the /etc/nginx/sites-dietpi/nginx.conf only holds the location config.
I have reserved sub-domains at my personal domain that I would like to use (actually 3 of them). For example, i have subdomain.domain.com reserved at Network Solutions, and I’d like to map that to an application running on my DietPi install. I’ve read through : Nginx Configuration - #7 by danmo117 a few times, and can’t make full sense out of it.
I currently have (in my restored /etc/nginx/sites-dietpi/nginx.conf)
I rebooted dietpi, and now nginx is actually responding, but it is only giving me the default nginx welcome page, and not sending me to the app that I want.
# Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to [nginx.org](http://nginx.org/).
Commercial support is available at [nginx.com](http://nginx.com/).
*Thank you for using nginx.*
There were similar questions about other apps like nextloud, I bet you will find some helpful threads if you use the search function. But it’s kinda pain in the ass to config this.
If you use SSL you also need new certs for the subdomain.
I recommend you to just use the subpaths
You would need to create individual server blocks. Close the main server block then open a new one for each sub domain.
server {
server_name example.com;
# the rest of the config
}
server {
server_name sub1.example.com;
# sub1 config
}
server {
server_name sub2.example.com;
# sub2 config
}
Please anybody share updated default file in folder " /etc/nginx/sites-enabled". i want to reverse proxy for dietpi installed software homeassistant, vaultwarden, adguard, plex, dietpi-dash board. i want to access all these software with my purchased domain name (with subdomain url). I also want to use my wildcard self signed certificate for all these program. In past i did this with docker but now i just migrate completely to dietpi default software with nginx used as reverse proxy.
Thanks Totila, I also confirm your vaultwarden.conf file is working. only thing i have to change. proxy_pass http://PI.IP:8001 to proxy_pass https://PI.IP:8001 as by default in dietpi vaultwarden works on https. so i have to put individual files for homeasssitant, adguard, plex, dietpi-dashboard.
Thanks Joulinar,
please suggest me where i have to feed my location of wildcard selfsigned certficate/key location for each service. is i have to write in my each custom site-enabled *.conf file or we can put somewhere on top so that each service use that key/certficate. i like to put on separate for each individual file.