Difference between revisions of "Web Server"
m (→SSL Server Certificates) |
m (→SSL Server Certificates) |
||
Line 85: | Line 85: | ||
3 - Use value: /home/mitna/CA/chain.pem | 3 - Use value: /home/mitna/CA/chain.pem | ||
e.g. SSLCertificateChainFile /home/mitna/CA/chain.pem | e.g. SSLCertificateChainFile /home/mitna/CA/chain.pem | ||
− | 4 - Create /home/mitna/CA/chain.pem by copying *only* the contents of the "Intermediates/root only" part of the certificate (first 2 parts) | + | 4 - Create /home/mitna/CA/chain.pem by copying *only* the |
+ | contents of the "Intermediates/root only" part of the | ||
+ | certificate (first 2 parts) | ||
5 - Restart apache (or do it after updating sailing.pem) | 5 - Restart apache (or do it after updating sailing.pem) | ||
Revision as of 00:23, 2 April 2013
This entry contains information on the packages installed in the web server and the process followed for their installation.
The Wiki began very late in the process, so it will be completed slowly over time.
Contents
Volunteer Web Server Introduction
Accounts are setup to try to use the same username and password as MIT Athena. To login to the server you need to point an SSH (secure telnet) client to:
sailing.mit.edu
Users also have a local password, different than the Athena password, which is required to use "sudo".
A general knowledge of both HTML and PHP is expected.
All the website files are all located at:
/home/mitna
The main public website is at:
/home/mitna/public_html
The secure parts of the site are at:
/home/mitna/ssl_html
Utility files (very important - they define the framework of the site) are at:
/home/mitna/includes
To understand the basic structure of webpages please see the templates at:
/home/mitna/public_html/template_full.php /home/mitna/public_html/template_noevents.php
Always keep the general structure of the website as is; please do not create new directories unless you have consulted the webmaster.
General Server Setup
Two servers have been setup since the Wiki was started, both using Debian:
SSL Server Certificates
When certificates expire (they are given for one year at a time), you need to send a new certificate request to
mitcert@mit.edu
Follow the directions at:
http://web.mit.edu/apache-ssl/www-rev11/README.certificate
Do everything out of /home/mitna/CA (you don't need to do anything on Athena, all local on the server)
The files you really need at the end are:
req.pem sailing.key (I like this name instead of https-key.pem)
(rename the old ones reqYY-YY.pem and sailingYY-YY.key, where YY-YY are the years the file is valid, e.g. 07-08 were the first ones)
Feel free to delete foo.
E-mail req.pem to mitcert@mit.edu SAVE sailing.key, it is essential
When you receive the Certificate:
Again in /home/mitna/CA
1 - Rename sailing.pem to sailingYY-YY.pem 2 - Create a new sailing.pem 3 - Put in it: a) the contents of sailing.key b) the exact e-mail with the certificate, starting with Certificate: then the rest. Include all --- BEGIN --- and --- END --- lines 4 - Restart apache (sudo apache2ctl restart)
You're done. Check that the certificate has updated.
- UPDATE 2012-2013 ***
MIT now uses "chain" certificates from a comercial authority (hopefully to prevent people from getting the "we don't know your Certificate Authority" warning/error in browsers. In order to make this work, when you get the Certificate:
- FIRST TIME ONLY*
Update the configuration of Apache to use a "ChainFile":
1 - Find ssl.conf 2 - Uncomment SSLCertificateChainFile 3 - Use value: /home/mitna/CA/chain.pem e.g. SSLCertificateChainFile /home/mitna/CA/chain.pem 4 - Create /home/mitna/CA/chain.pem by copying *only* the contents of the "Intermediates/root only" part of the certificate (first 2 parts) 5 - Restart apache (or do it after updating sailing.pem)
- FUTURE YEARS*
1 - Update "sailing.pem" as before 2 - Check if "chain.pen" needs updating
Weather Station
The Weather Station is a Vantage Pro2 hard wired model.
USB
To get the USB-serial (CP2102) working I followed these steps:
sudo mount -t usbfs usbdevfs /proc/bus/usb sudo cat /proc/bus/usb/devices
which tells you the VID and PID for:
sudo modprobe usbserial vendor=0x10c4 product=0xea61
after which by running
sudo dmesg
you should something like the following:
usbserial_generic 1-1:1.0: generic converter detected usb 1-1: generic converter now attached to ttyUSB0 usbcore: registered new driver usbserial_generic
At this point the setup should be connected.
You configure the baud rate using
sudo stty -F /dev/ttyUSB0 19200
and can see the current configuration with
sudo stty -F /dev/ttyUSB0
This should make it work (NOTE: 2010/07/02 having problems, cannot connect to the console, not sure why...)
Problem is:
- The device *does* show up as /dev/ttyUSB0 - BUT when I try to open the device with either minicom, or the software I had always used (vproweather), the window hangs until I disconnect the device. Basically, the drivers see the device, but I can't actually send/receive data out of it.
The frustrating part is that the software was working fine, but when the new (replacement) hardware came in, the software would not work any more! Now I'm very lost...
NEW
W View did not make me happy (it could not give 'real-time' results, only show things about every minute or even more... plus I could not get it to save data to the database to interface easily with PHP.
So, I looked more around, and found this super easy program to use:
http://www.joejaworski.com/weather/
Since our station is in USB and next to the computer, the ONLY software needed is:
vproweather http://www.joejaworski.com/weather/vproweather-0.6.tgz
I downloaded/untared it to:
/usr/local/pkgs/vproweather-0.6/
A simple 'make' (using sudo) was all that was needed to compile it. Then, running it with:
/usr/local/pkgs/vproweather-0.6/vproweather -x /dev/ttyUSB0
Gives real time data, and using '-l' instead of '-x' gives low/high data.
I put this in a cron to run the real-time every 1 minute (fastes crontab can do) and update a table in the database, which is then used by the rest of the site (table: weather). The low/high will run once a day.
Hopefully I'll be able to create a daemon which updates the table every 10 seconds or so... we'll see.
"Dynamic" Update
In order to update the weather information dynamically, I got the following packages online:
ajax-dynamic-contant.js - from DHTMLGoodies.com (Alf Magne Kalleland) ajax.js - Simple AJAX Code Kit (SACK) - twilightuniverse.com (Gregory Wild-Smith)
I then modified vpro.php to create a file in
html/inc/weather.txt
which updated every time the cron process runs and which is read by the ajax tools.
The header function in format.php now calls a set of javascript functions which load the weather.txt file, instead of using sql to obtain the information from the database.
Now the weather information updates dynamically, without having to reload a page.
OLD
The linux software is W View. I followed the User Manual detailed instructions.
Install (untar) to:
- /usr/local/pkgs/wview-3.3.0
Commands (what should be done next time in order, I did not do it in this order):
- Installed mysqlclient-dev: sudo apt-get install libmysqlclient-dev
- Installed libpng-dev: sudo apt-get install libpng12-dev
- Install 'radlib':
- get .tar
- install to /urs/local/pkgs/radlib-2.7.0
- ./configure
- make
- sudo make install
- edit /etc/ld.so.conf --> add /usr/local/lib --> run ldconfig
- Install 'libgd' (all with sudo):
- get .tar
- install to /usr/local/pkgs/gd-2.0.35
- ./configure
- make
- make install
- ./configure --enable-mysql
- sudo make
- sudo make install
Not working! Will need to check USB drivers/connection