Using nginx for WeeWX web server

133 views
Skip to first unread message

David VE3STI

unread,
Jan 2, 2025, 4:03:37 PM1/2/25
to weewx-user
My 2016 WeeWX setup recently crashed so I decided to upgrade with a fresh install with Raspberry Pi OS (Bullseye - I'm using a RPi Zero W as my dedicated computer) and WeeWX 5.1. I am a complete klutz in Linux so I tried to follow the installation instructions as closely as possible.

All went well until I began setting up the local web server. I chose nginx because I have a low power RPi Zero W and because I used nginx in 2016. Unfortunately, I had long since forgotten how I set it up. I used the instructions at the GitHub wiki 

server {
  location /weewx {
    alias /home/weewx/public_html;
  }

to the 'default' file in the </etc/nginx/sites-available/> folder.

However, this did not work with my installation. After much head-scratching, I edited the 'alias' line to:

alias /var/www/html/weewx/;

Because of my limited knowledge of WeeWX and nginx, I didn't try to fiddle with the wiki entry. I don't think I did anything out of the ordinary during the installation. Could these instructions be for an older version of  WeeWX? Maybe someone who knows can figure out if the wiki needs to be corrected - the current suggestion didn't work for me.

All now seems to be working well with my WeeWX+RPi Zero W+Vantage Vue weather station setup. I hope this helps someone.

David
VE3STI
Picton, ON  Canada

vince

unread,
Jan 2, 2025, 4:19:18 PM1/2/25
to weewx-user
I've always thought of the how to integrate with a webserver docs as notional rather than step-by-step-do-this-verbatim.

Graham Eddy

unread,
Jan 2, 2025, 9:41:37 PM1/2/25
to WeeWX User
i agree with vince: weewx provides a root directory for its html tree, and there its responsibility towards nginx ends.
nginx picks up from there, and maps the weewx html root to url location / (if the website is dedicated to weewx)
so if weewx root html is /home/weewx/station/public_html then nginx interface to weewx would be something like:
server {
  root /home/weewx/station/public_html;
  index index.html;
  location / {
    try_files $uri $uri/ =404;
  }
}
noting that nginx interface to network (server name, ports to listen to etc) are in addition.
cheers
⊣GE⊢

-- 
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/86c1677e-a8aa-49fb-aa82-fdfe96d59bfbn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages