Installation manual for WebSolarLog

This manual is only about installing WebSolarLog on a RaspberryPi with Nginx.

Prerequisite:

  • basic linux knowledge
  • a fully functional Linux host
  • The communication between host and inverter is working

Lets go install WebSolarLog: Some explanation on the manual:

  • green are prompt commands
  • red are file system directories
  • blue are (important) notes
  • light-blue are URL’s

NOTE:
All the package-names that we install, are based on Raspian (Debian). Also it could that your system already has alot of the packeges we need. If you ran into a “apt-get install” error, please check if the name we suggest is the same name for your distro.

  1. Install subversion, to directly download a SVN version from Sourceforge in a later steps.
    • sudo apt-get install subversion
  2. Install the webserver, sqlite and php services;
    • sudo apt-get install php5-common
    • sudo apt-get install php5-cli
    • sudo apt-get install php5-fpm
    • sudo apt-get install nginx
    • sudo apt-get install php5-cgi
    • sudo apt-get install php5-svn
    • sudo apt-get install php5-sqlite
    • sudo apt-get install php5-mcrypt
    • sudo apt-get install php5-curlIt is possible to install all of the above in a single command line;
    • sudo apt-get install php5-common php5-cli php5-fpm nginx php5-cgi php5-svn php5-sqlite php5-mcrypt libjs-jquery php5-curl
  3. Now NginX should be installed and we need to edit the config.
    In most cases NginX will be installed in /etc/nginx/
  4. lets change the Nginx config so we can parse PHP files:
    • sudo nano /etc/nginx/sites-available/default
  5. Look for the “server” section and replace everything from server{ till the corresponding } with this;
server{
	listen 80; ## listen for ipv4; this line is default and implied
	#listen [::]:80 default_server ipv6only=on; ## listen for ipv6

	root /usr/share/nginx/www;
	index index.php index.html index.htm;

	#Make site accessible from http://localhost/
	server_name localhost;

	location / {
		#First attempt to serve request as file, then
		#as directory, then fall back to displaying a 404.
		#try_files $uri $uri/ /index.html;
		#Uncomment to enable naxsi on this location
		#include /etc/nginx/naxsi.rules
	}
	location /doc/{
		alias /usr/share/doc/;
		autoindex on;
		allow 127.0.0.1;
		allow ::1;
		deny all;
	}
 ######### php config #########
 include php.conf;
 ##############################
}
  1. The server{} section of /etc/nginx/sites-available/default should now looks like this;nginx-config-with-php-config
  2. Now we are going to create the php.conf file;sudo nano /etc/nginx/php.confAdd the following lines to the /etc/nginx/php.conf;

#############################################################

fastcgi_intercept_errors on;
# this will allow Nginx to intercept 4xx/5xx error codes
# Nginx will only intercept if there are error page rules defined
# -- This is better placed in the http {} block as a default
# -- so that in the case of wordpress, you can turn it off specifically
# -- in that virtual host's server block

location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# A handy function that became available in 0.7.31 that breaks down
# The path information based on the provided regex expression
# This is handy for requests such as file.php/some/paths/here/
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
#############################################################
  1. Lets restart the PHP and NginX services;
    • sudo service php5-fpm restart 
    • sudo service nginx restart
  2. Test the installation by entering;
    http://ipAddressOfTheRpi 
    It should come up with the webserver “welcome” screen.
  3. We now go to the /usr/share/nginx/www/ directory:
    cd /usr/share/nginx/www/
  4. make the websolarlog directory;
    mkdir websolarlog
    NOTE: In some cases it is not possible to create the websolarlog directory in /usr/share/nginx/www/
    a workaround for this is to CHMOD the
    /usr/share/nginx/www/ to 777:
    sudo chmod -R 777 /usr/share/nginx/www/

    We do not advice you to have a 777 webserver folder connected to the internet. So please downgrade the rights for your needs/security.
  5. You should now have a /usr/share/nginx/www/websolarlog directory:
    cd /usr/share/nginx/www/websolarlog/If you are using the WebSolarLog Image installation, please go to Step 17

  6. We are now going to install the WebSolarLog software.
  7. The following command will use Subversion (installed in step 1) to download WebSolarLog from SourceForge.net and place it in the directory in Red. The directory in Red must reflect the path in step 12.
    sudo svn checkout http://svn.code.sf.net/p/websolarlog/code/trunk /usr/share/nginx/www/websolarlog
  8. For the installation we advice you to do a sudo chmod 777 on the websolarlog folder. Otherwise it cannot continue.
    sudo chmod -R 777 /usr/share/nginx/www/websolarlog/ 
    NOTE: We do not advice you to run websolarlog with 777 on a internet connected device. When your device is connected to the internet, we advice you to “downgrade” the rights of the websolarlog directory. You may change it to 766;
    sudo chmod -R 766 /usr/share/nginx/www/websolarlog/
  9. Start WebSolarLog on the prompt with the following command:
    sudo /usr/share/nginx/www/websolarlog/scripts/./wsl.sh startTo stop WSL use:
    sudo /usr/share/nginx/www/websolarlog/scripts/./wsl.sh stop
  10. If you want WebSolarLog to start with your system:
    sudo nano /etc/rc.local
    Add the following line to the end of this file:
    sudo /usr/share/nginx/www/websolarlog/scripts/./wsl.sh start
  11. To be sure the webserver can write to the websolarlog directory, execute the following command:
    sudo chown www-data:www-data /usr/share/nginx/www/websolarlog/ 
  12. To be 100% sure that we have enough rights on the websolarlog directory, execute the following command:
    sudo chmod -R 777 /usr/share/nginx/www/websolarlog/ 
  13. Go to the Admin to configure WebSolarLog: http://ipAddressOfTheRpi/websolarlog/admin/
  14. You should see a login page.
  15. Now login with:
    username: admin
    password: admin

We soon will publish a WebSolarLog configuration manual