Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 1 of 2   [ 18 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Servidor web para Opengarden
PostPosted: Fri Mar 10, 2017 4:12 pm 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Hola, cuando haga funcionar el código (estoy hablando con vosotros en otras entradas), tengo intención de contratar un servidor en la nube para visualizar los datos de la app en el móvil sin tener que utilizar mi PC para ello.
Ahora tengo funcionando el servidor en mi PC con Windows, pero la mayoría de los servidores disponibles en la nube tienen Linux. Cómo el código fuente de la aplicación web está desarrollado para Ubuntu, quisiera saber si es compatible con Linux y si hay que realizar algún cambio en el mismo o tener en cuenta algún aspecto para la implementación.

Muchas gracias


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Mon Mar 13, 2017 8:54 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

si, el código es compatible con Linux. Si tienes cualquier duda con la configuración no dudes en preguntarnos.

Un saludo.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Thu Mar 16, 2017 7:00 pm 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Hola, al final he montado un servidor remoto en Ubuntu.
He instalado Apache2 PHP y MySQL y he podido crear la BBDD de opengarden. La aplicación PhpMyAdmin tambien funciona perfectamente. Pero no me deja conectarme a la aplicación web opengarden-app, me da el siguiente mensaje:

The requested URL /opengarden-app was not found on this server (404 Not Found)
Apache/2.4.18 (Ubuntu) Server at ..Mi IP permanente.. Port 80

He configurado el fichero con los nuevos datos (config.php) y revisado los permisos de los ficheros y carpetas source code of the web application y en principio están correctos.

Cuando monté el servidor local Xampp en windows no tuve problemas para conectarme a la app.
Ya me decís qué puede estar pasando. Gracias por anticipado.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Fri Mar 17, 2017 8:47 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

revisa por favor si la carpeta "opengarden-app" existe en el directorio raiz del servidor al que estas accediendo, ya que según el error 404, no puede acceder porque posiblemente no existe.

Un saludo


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Fri Mar 17, 2017 12:47 pm 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Si, lo tengo en: /var/www/opengarden-app y cómo os comentaba tanto a esta carpeta, cómo los ficheros .php, les he dado permisos totales (chmod 777). No he "tocado" los permisos de las subcarpetas de opengarden-app, porque supongo que no será necesario.

He copiado todos estos ficheros desde mi PC al servidor remoto con "FileZilla", no se si esto tiene algo que ver.
En /var/www/ existe la carpeta html, ¿debería copiarlo todo ahí?


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Mon Mar 20, 2017 9:03 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

prueba por favor de nuevo dando permiso de forma recursiva a todos los ficheros de las subcarpetas, ya que si es necesario.

Un saludo.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Mon Mar 20, 2017 4:48 pm 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Nada, he dado permisos totales a todas las subcarpetas y a todos los los ficheros y sigue saliendo lo mismo.

Después he probado a ponerlo en: /var/www/html/opengarden-app con los permisos totales para todo (777) y sí, ahora aparece aplicación opengarden-app y puedo entrar en ella, pero:

1) La aplicación web no tiene comunicación con la BBDD, puesto que no aparecen los valores de los actuadores (y en la BBDD si tienen estado y puedo cambiarlo). El fichero config.php está modificado con los nuevos valores, y en el servidor local me funcionaba.
Puede ser un problema de path al cambiar el directorio, o quizas que algunos ficheros deban quedarse en /var/www, pero en cualquier caso no se qué ficheros debo modificar.


2) No se rellena la BBDD con los datos obtenidos con "setSensors", aunque en el monitor serie aparece todo correcto, es decir, que se obtienen los valores de los sensores del gateway y de los nodos y no hay problema con la wifi. Además parece que tampoco lee los datos de los actuadores con getActuators, ya que sale BAD DATA.
Está cambiada la IP del nuevo servidor en el código de Arduino y mi router tiene conexión wifi y salida a internet mediante ethernet y obtengo respuesta del servidor "Libelium_wsn2" del "test.libelium.com".


Ya me decís. Gracias por anticipado.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Tue Mar 21, 2017 9:14 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

puedes comprobar cual es el directorio raíz de tu servidor en el archivo de configuración del Apache, el cual suele estar en la siguiente dirección:"/etc/apache2/apache2.conf"
Normalmente viene indicado con una entrada de este tipo: "Include sites-enabled/*.conf"

Ademas en ese directorio "etc/apache2/sites-enabled" tienes todos los virtual host configurados. Este es el de por defecto "/etc/apache2/sites-available/000-default.conf" y ahí te dice tu directorio raíz "/var/www/html".

Por otro lado puedes echar un vistazo al log de tu Apache para detectar fallos en la entrada de datos. El log suele estar en la siguiente ruta:"/var/log/apache2/"

Un saludo


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Wed Mar 22, 2017 11:08 am 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Hola, he consultado todos los ficheros que me indicáis, pero son algo diferentes por estar mi servidor en remoto. No obstante, parece que efectivamente la ruta es /var/www/html.
Y en este directorio html es dónde había metido todos los ficheros para la aplicación web. Esta aplicación se ejecuta, por tanto, en este directorio.

Pero con esto no se soluciona nada, sigo teniendo los mismos 2 problemas; por un lado que la BBDD no se comunica con la app web opengarden y por otro que no se registran los valores de los datos enviados por los sensores en la BBDD.

Está abierto el puerto 80 y el 3306 para "todos", y he realizado varias pruebas (ver los anteriores post) y todo lo demás funciona correctamente.

Sin embargo, el Fichero "error.log.1" si arroja alguna información:


****************"error. log"***************************************
[Wed Mar 22 06:25:02.206277 2017] [mpm_prefork:notice] [pid 16388] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Wed Mar 22 06:25:02.206295 2017] [core:notice] [pid 16388] AH00094: Command line: '/usr/sbin/apache2'



****************"error.log.1"***************************************

[Tue Mar 21 06:25:02.031720 2017] [mpm_prefork:notice] [pid 16388] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Tue Mar 21 06:25:02.031747 2017] [core:notice] [pid 16388] AH00094: Command line: '/usr/sbin/apache2'
[Tue Mar 21 15:49:58.260354 2017] [:error] [pid 18183] [client IPPúblicademiPC:58343] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/nodes
[Tue Mar 21 15:50:05.433634 2017] [:error] [pid 18184] [client IPPúblicademiPC:58347] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/sensors
[Tue Mar 21 15:50:07.522069 2017] [:error] [pid 18184] [client IPPúblicademiPC:58347] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/actuators
[Tue Mar 21 15:50:51.060208 2017] [:error] [pid 18392] [client IPPúblicademiPC:58364] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/nodes
[Tue Mar 21 15:50:54.031240 2017] [:error] [pid 18392] [client IPPúblicademiPC:58364] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/actuators
[Tue Mar 21 15:51:03.462822 2017] [:error] [pid 18186] [client IPPúblicademiPC:58370] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/
[Wed Mar 22 06:25:02.135209 2017] [mpm_prefork:notice] [pid 16388] AH00171: Graceful restart requested, doing restart


He buscado en Internet el error pero la información que he encontrado no me ha servido de nada, por lo que os la paso para que indiquéis cómo podemos solucionarlo.
Muchas gracias.



P.D: No obstante, por si acaso, os adjuto también la información contenida en los otros dos ficheros que me indicáis:


******************"Apache2.conf"*******************************

# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
# /etc/apache2/
# |-- apache2.conf
# | `-- ports.conf
# |-- mods-enabled
# | |-- *.load
# | `-- *.conf
# |-- conf-enabled
# | `-- *.conf
# `-- sites-enabled
# `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
# together by including all remaining configuration files when starting up the
# web server.
#
# * ports.conf is always included from the main configuration file. It is
# supposed to determine listening ports for incoming connections which can be
# customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
# directories contain particular configuration snippets which manage modules,
# global configuration fragments, or virtual host configurations,
# respectively.
#
# They are activated by symlinking available configuration files from their
# respective *-available/ counterparts. These should be managed by using our
# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
# their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
# the default configuration, apache2 needs to be started/stopped with
# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
# work with the default configuration.

# Global configuration
#
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., http://www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf

# 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>


# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
#loadModule php5_module modules/libphp5.so
#addType application/x-http-php.php
#addType application/x-http-php-source.phps



****************"000-default.conf"***************************************
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName http://www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Thu Mar 23, 2017 9:44 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

el problema puede ser que no tengas bien configurada la base de datos en el fichero de configuración, o que la base de datos no acepta la conexión. Puedes comprobar la IP, puerto...

Si desde la terminal del servidor donde tienes el Apache puedes acceder a la base de datos, la app tambien accederá y para ello puedes hacerlo escribiendo:
Code:
mysql -u <usuario> -p -h <database_ip>

Aquí te pedirá credenciales para entrar.

Un saludo.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 18 posts ]
Go to page 1, 2  Next


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.