No CSS when using reverse proxy?

SYSTEM INFORMATION
OS type and version Ubuntu 22.04.4 LTS, codenamed “jammy.”
Virtualmin version Latest (Installed on my vps today(11/06/2024)

When I use ngix to set up reverse proxy my SSL fails and i’m routed to

When I add a webprefix my css dissapears.

Idk what to do. I’m lost

I use ngix because that’s what i used on another thing i installed. I tought i should probably not use multiple reverse proxy handlers on the same vps but idk?

I’ve seen mention of apache but I just can’t wrap my head around what’s the best course of action here.

Here’s my NGIX setup:

server {
    server_name server.example.com;

    location / {
        proxy_pass http://localhost:10000/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/server.example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/server.example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = server.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name server.example.com;
    return 404; # managed by Certbot
}

Here’s my webmin setups:
Config:

y_view=0
passwd_uindex=0
passwd_file=/path/to/passwd/file
find_pid_command=ps auwwwx | grep NAME | grep -v grep | awk '{ print $2 }'
tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
ld_env=LD_LIBRARY_PATH
path=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
passwd_pindex=1
os_type=debian-linux
os_version=13.0
real_os_type=Ubuntu Linux
real_os_version=22.04.4
lang=en
log=1
referers_none=1
md5pass=0
theme=authentic-theme
product=webmin
os_eol_in=2 years
os_eol=04/01/2027
#webprefix=/
webprefixignored=1
os_eol_about=0
os_eol_db=2.111
os_ext_eol_in=7 years
os_ext_eol=04/09/2032
referers=example.com
relative_redir=0

Miniserv.conf:

port=10000
root=/usr/share/webmin
mimetypes=/usr/share/webmin/mime.types
addtype_cgi=internal/cgi
realm=Webmin Server
logfile=/var/webmin/miniserv.log
errorlog=/var/webmin/miniserv.error
pidfile=/var/webmin/miniserv.pid
logtime=168
ssl=0
no_ssl2=1
no_ssl3=1
ssl_honorcipherorder=1
no_sslcompression=1
env_WEBMIN_CONFIG=/etc/webmin
env_WEBMIN_VAR=/var/webmin
atboot=1
logout=/etc/webmin/logout-flag
listen=10000
denyfile=\.pl$
log=1
blockhost_failures=5
blockhost_time=60
syslog=1
ipv6=1
session=1
premodules=WebminCore
server=MiniServ/2.111
userfile=/etc/webmin/miniserv.users
keyfile=/etc/webmin/miniserv.pem
passwd_file=/etc/shadow
passwd_uindex=0
passwd_pindex=1
passwd_cindex=2
passwd_mindex=4
passwd_mode=0
preroot=authentic-theme
passdelay=1
logout_script=/etc/webmin/logout.pl
failed_script=/etc/webmin/failed.pl
cipher_list_def=1
login_script=/etc/webmin/login.pl
sudo=1
error_handler_404=404.cgi
error_handler_403=403.cgi
error_handler_401=401.cgi
nolog=\/stats\.cgi\?xhr\-stats\=general
ssl_redirect=0

all help is really appreciated

What browser are you using? When I did a proxy for a docker container Firefox complained the images were coming from a different source. Other browsers were OK.

Second. Could you clarify your setup? Why are you using a proxy here? Is it on the same machine or a different?

That nginx setup doesn’t look anything like the default used by a virtualmin install, i setup my first virtualmin lemp install today so i am no nginx expert (always used apache and will continue to use it). It might be worth starting from the default virtualmin nginx config files and also use webmin/virtualmin interface to make modifications

Hello,

I’d recommend checking the Webmin FAQ, which describes in detail how to set up Webmin behind an Nginx proxy:

1 Like

Almost everyone in the world puts the day first.

1 Like

Hmm… I’ve known the format exists but I guess I’ve never seen it in practice. I’ll strike it and you can clean up as needed then.

I’m using chrome.

I’m using reverse proxy to link up my domain to my server. The ngix is on the same machine as the vps

When i installed this on my vps i didn’t get a default ngix config.

Thanks so much! I tried using the search feature on the faq to find ngix related documentation but it never actually laoded. I appreciate this.

Webmin/Virtualmin has it’s own server, unrelated to the web browser. If you remove the configuration from Nginx it should ‘just work’ unless I’m missing something. But, I’m more of a network person. :wink:

you did install with the --LEMP option I assume?
/usr/bin/wget https://software.virtualmin.com/gpl/scripts/install.sh
followed by:
sudo /bin/sh install.sh --bundle LEMP

on a clean OS
then not altered any config - just added a VS in Virtualmin->Create Virtual Server

I have a follow up question. I’m still new to VPS’s and i’ve heard using this for reverse proxy is good:

I still can’t completely get it to work. Based on the FAQ I have the details in there but instead of an css issue i’m getting 502 bad gateway

Virtuamin install script will install all you need and config everything for you.

On a clean VPS, download the virtualmin-install.sh using wget https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh
then run sh virtualmin-install.sh --bundle LEMP
Virtualmin will do the NGINX install and everything else you need to host a website, like a web, mail, ftp dns etc.
image

You don’t need NGINX to be supplied from your VPS (you want a clean VPS OS), the install will do that for you.

Proxy shouldn’t be needed if your doing standard web hosting.

You don’t need Nginx Proxy Manager

seems like its a Docker thing.

I presume thats the same script as https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.