Webserver showing default Apache page instead of weewx

79 views
Skip to first unread message

Jimmy Kirk

unread,
Nov 21, 2020, 4:58:06 PM11/21/20
to weewx-user
This is a new install using the python tool setup.py method... After installing weewx and apache2 and browsing to it, I am seeing the /var/www/html/index.html page instead of the  /home/weewx/public_html/index.html page. I followed these instructions in the guide, for telling Apache where to find the weewx reports:
--------------------------------------
sudo cp util/apache/conf.d/weewx.conf /etc/apache2/conf.d

Be sure that the path in the Apache configuration snippet matches the HTML_ROOT defined in the WeeWX configuration file. For example, the path for a default setup.py installation would look like this:

Alias /weewx /home/weewx/public_html
 <Directory /home/weewx/public_html>
        Options FollowSymlinks
        AllowOverride None
</Directory>

Restart Apache to make the changes happen:
sudo /etc/init.d/apache2 restart  
---------------------------------------------------------------

Do I need to edit the /etc/apache2/apache2.conf file in this section?:

# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

If anyone can help figure out what is wrong I would appreciate it. Console is Vantage. Let me know if I did not provide enough info...

Thanks,
Jimmy


vince

unread,
Nov 21, 2020, 5:29:37 PM11/21/20
to weewx-user
On Saturday, November 21, 2020 at 8:58:06 AM UTC-8 jd....@gmail.com wrote:
This is a new install using the python tool setup.py method... After installing weewx and apache2 and browsing to it, I am seeing the /var/www/html/index.html page instead of the  /home/weewx/public_html/index.html page. 

If you followed the instructions exactly, your weewx web is one level down from the top of your apache HTML_ROOT.

Try opening http://your.hostname.here/weewx and see if you see weewx pages....

Quick explanation is the content of the ...conf.d/weewx.conf file
  Alias /weewx /home/weewx/public_html
   <Directory /home/weewx/public_html> 
          Options FollowSymlinks 
          AllowOverride None 
  </Directory>


What the Alias line says is "when somebody asks for http://your.hostname.here/weewx from a web browser, give them the content of /home/weewx/public_html located in the  apache computer's filesystem'...

Jimmy Kirk

unread,
Nov 21, 2020, 7:27:21 PM11/21/20
to weewx-user
Thanks Vince... 
I actually tried that also... So if I type the hostname I get the default Apache page, and if I append "/weewx" I get this:
Not Found

The requested URL was not found on this server.

Apache/2.4.38 (Raspbian) Server at kirklabs.com Port 80  

vince

unread,
Nov 21, 2020, 7:47:10 PM11/21/20
to weewx-user
You always want to look at your logs for both syslog and apache for the gory details.

There are a couple alternate ways to get there....
  • edit weewx.conf to tell it where to write its html to
    • at the top of the [[StandardReport]] section in weewx.conf, edit HTML_ROOT to point to /var/www/html which is where Apache thinks the web root is (weewx restart required)
  • or point the apache DOCROOT at weewx's tree
    • rename /var/www/html and create a symlink pointing to /home/weewx/public_html  (no apache or weewx restarts needed)
  • or point the weewx's HTML_ROOT at apache's tree
    • rename /home/weewx/public_html and create a symlink pointing to /var/www/html (weewx restart required)
FWIW, I use the second method here but that's just how I chose to do it.

Greg from Oz

unread,
Nov 21, 2020, 9:53:05 PM11/21/20
to weewx-user
I think you should put the weewx.conf into /etc/apache2/sites-available/
The run sudo a2ensite (this will enable the site)
Then run: sudo systemctl restart apache2.service

I don't know what system you are running apache on but the above should work with Ubuntu (debian)

Jimmy Kirk

unread,
Nov 23, 2020, 4:04:40 AM11/23/20
to weewx-user
OK thanks guys... I'm a bit of a linux noob so I am not sure how to do symbolic links. Therefore I opted to change the directory where the web pages are living, to:
HTML_ROOT = /var/www/html - This fixed it... but now I have another issue, undoubtedly related to the Vantage data corruption issue. I now get the correct web server, but the web page shows a date from two days ago and does not update. When I try to run wee_device commands I get a permissions issue on the USB port. PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'  How can I get permissions on the USB port? (Remember Linux noob)... I can start a new topic about this if necessary.

Greg from Oz

unread,
Nov 23, 2020, 4:36:15 AM11/23/20
to weewx-user
If you run the command and add sudo before the command then it will run as root.

 sudo wee_device

If you add the user to the dialout group then that user will have permission to use the USB without out having to run sudo.



Jimmy Kirk

unread,
Nov 23, 2020, 4:59:15 AM11/23/20
to weewx-user
Sorry Greg, should have mentioned that I already tried running it with sudo, with interesting results. Here's what I get, running without sudo, then with sudo...
. . .
weewx@weewx:~ $ wee_device --clear-memory
Using configuration file /home/weewx/weewx.conf
Using Vantage driver version 3.2.1 (weewx.drivers.vantage)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/weewx/bin/wee_device", line 78, in <module>
    main()
  File "/home/weewx/bin/wee_device", line 74, in main
    device.configure(config_dict)
  File "/home/weewx/bin/weewx/drivers/__init__.py", line 67, in configure
    self.do_options(options, parser, config_dict, not options.noprompt)
  File "/home/weewx/bin/weewx/drivers/vantage.py", line 2056, in do_options
    station = Vantage(**config_dict[DRIVER_NAME])
  File "/home/weewx/bin/weewx/drivers/vantage.py", line 512, in __init__
    self.port.openPort()
  File "/home/weewx/bin/weewx/drivers/vantage.py", line 307, in openPort
    self.serial_port = serial.Serial(self.port, self.baudrate, timeout=self.timeout)
  File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
. . .
weewx@weewx:~ $ sudo wee_device --clear-memory
[sudo] password for weewx:
sudo: wee_device: command not found

So how do I add the user to the dialout group? Is that like the sudoers group? (not sure how to do the sudoers group either).

Greg from Oz

unread,
Nov 23, 2020, 5:09:15 AM11/23/20
to weewx-user
It is not like the sudoers. It is just a group.

Look here:
It will show you how to add the group to the user.

If the sudo wee_device comes back with command not found then that means it is not in the path and then you will have to usr the absolute path to run the command.

E.G If the wee_device is in /home/weewx/bin then you would have to run:
sudo  /home/weewx/bin/wee_device
Reply all
Reply to author
Forward
0 new messages