Files
weewx/docs_src/usersguide/webserver.md
Tom Keffer 3147301106 Updated docs to mkdocs v1.5.
Mostly involved changing links to suppress warnings
2023-11-19 16:18:49 -08:00

88 lines
2.9 KiB
Markdown

# 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_](https://github.com/weewx/weewx/wiki/Configure-a-web-server-(Apache,-NGINX-or-lighttpd)) 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]`](../reference/weewx-options/stdreport.md) 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`:
```ini
[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:
```ini
[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]`:
``` ini
[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]]`] [ftp] and [`[[RSYNC]]`] [rsync]
sections of the configuration file `weewx.conf` for details and options.
[ftp]: ../reference/weewx-options/stdreport.md#ftp "[[FTP]] section"
[rsync]: ../reference/weewx-options/stdreport.md/#rsync "[[RSYNC]] section"