Files
weewx/docs_src/usersguide/webserver-integration.md
Tom Keffer 2fe42433fe Rename docs subdirectories.
docs -> docs_src
html_docs -> docs

This puts the names closer to the end product.
2023-04-04 07:27:42 -07:00

66 lines
2.4 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. See the wiki article [Configure a web server](https://github.com/weewx/weewx/wiki/Configure-a-web-server-(Apache,-NGINX-or-lighttpd)) for how to do this.
## 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]`](../../usersguide/weewx-config-file/stdreport-config/) 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]: ../weewx-config-file/stdreport-config/#ftp "[[FTP]] section"
[rsync]: ../weewx-config-file/stdreport-config/#rsync "[[RSYNC]] section"