Skip to content

Integrating with a web server

If the server is on the same machine

The reports generated by WeeWX can be served by a web server running on the same machine as WeeWX. The WeeWX reports work with most web servers, including Apache, nginx, and lighttpd.

There are a few strategies for making the web server see the WeeWX reports. You can modify the web server configuration, you can modify the WeeWX configuration, or you can make links in the file system. The strategy you choose depends on the operating system, web server, how you installed WeeWX, and how you prefer to manage your system. If you installed WeeWX using a Debian/Redhat/SUSE installer, you might not have to do anything!

See the wiki article Configure a web server for details.

If the server is on a different machine

Use FTP or RSYNC to transfer the files generated by WeeWX to your remote server. In WeeWX, FTP and RSYNC are implemented as reports. They are configured in the [StdReport] section of the WeeWX configuration file.

For example, the following configuration would use RSYNC to copy the html and images files from the standard report to a folder /var/www/html/weewx on the server wx.example.com:

[StdReport]
    [[RSYNC]]
        skin = Rsync
        server = wx.example.com
        path = /var/www/html/weewx
        user = wxuser

The following configuration would use FTP to copy the html and image files:

[StdReport]
    [[FTP]]
        skin = Ftp
        server = wx.example.com
        path = /weewx
        user = wxuser
        password = wxpass

It is possible to rsync or FTP more than one directory to the remote server. For example, suppose you have a home webcam that puts its images in /home/webcam/www. You want to FTP not only the files generated by WeeWX, but also these webcam images, to a remote server. The webcam images should go in a subdirectory webcam of the weewx directory. The solution is to include more than one FTP section under [StdReport]:

[StdReport]

    # Location of the generated reports, relative to WEEWX_ROOT
    HTML_ROOT = public_html

    ...

    # As before:
    [[FTP]]
        skin = Ftp
        server = wx.example.com
        path = /weewx
        user = wxuser
        password = wxpass

    # Add a second FTP. You can name it anything.
    [[webcam_FTP]]
        skin = Ftp
        # Override HTML_ROOT:
        HTML_ROOT=/home/webcam/www
        server = wx.example.com
        path = /weewx/webcam
        user = wxuser
        password = wxpass

See the documentation for the [[FTP]] and [[RSYNC]] sections of the configuration file weewx.conf for details and options.