[object Object] Fehler in der WebApp aus der FreeNAS Jail

Euer Thema passt nirgendwo anders rein? Dann gehört es hier hin!

[object Object] Fehler in der WebApp aus der FreeNAS Jail

Beitragvon Beldion » Mi 11. Nov 2015, 01:39

Moin Moin,

zuerst vielen Dank für Powerswitch und die WebApp!!
Bisher lief die WebApp zuverlässig auf meiner Fritzbox die durch ein Firmwareupdate aber leider nicht mehr in der Lage ist das Hosting zu übernehmen.

Als Alternative habe ich in meinem FreeNAS Server in einer Jail php5.6 und php5.6 extensions, sowie NGINX installiert.

Die Webseite wird mir nun auch angezeigt, aber sobald ich eine Aktion klicke passiert nix, abgesehen von der Fehlermeldung [object Object].

In der php.ini habe ich extension=php_sockets.dll aktiviert.

Mein debug.log sagt:
2015-11-11 00:27:39 192.168.178.202 1447198059 Running in action='on'
2015-11-11 00:27:39 192.168.178.202 1447198059 Send Message for device='1' action='ON'
2015-11-11 00:27:39 192.168.178.202 1447198059 Create ConnAir Message for Elro device='1' action='ON'
2015-11-11 00:27:39 192.168.178.202 1447198059 Sending Message to ConnAir with id ''
Beldion
 
Beiträge: 3
Registriert: Mi 11. Nov 2015, 00:38

Re: [object Object] Fehler in der WebApp aus der FreeNAS Jai

Beitragvon Beldion » So 15. Nov 2015, 23:02

Weiß niemand woher die [object Object] Fehler kommen könnte?
Beldion
 
Beiträge: 3
Registriert: Mi 11. Nov 2015, 00:38

Re: [object Object] Fehler in der WebApp aus der FreeNAS Jai

Beitragvon Kleiner Mann » Mo 16. Nov 2015, 21:29

Moin!

Meistens liegt es daran, dass das Connairgerät nicht erreicht werden kann. Ich hatte den Fehler immer wenn das Wlan noch ausgeschaltet war...
Also würde ich da irgendwo ganz primitiv anfangen und gucken:
Stimmt die IP und der Port vom Connair?
Habe ich Wlan verbindung?
...
Vielleicht mal mit nem anderen Browser probieren, wer weiß was sich da verstellt hat...

LG Kleiner Mann :)
  • Rasperry PI mit Webappmod und Temperaturen vom Haus
  • FritzBox mit Webappmod
  • Arduino als Connair und Temperaturaufzeichner :D
Kleiner Mann
 
Beiträge: 243
Registriert: Sa 27. Jul 2013, 11:35

Re: [object Object] Fehler in der WebApp aus der FreeNAS Jai

Beitragvon Beldion » Sa 21. Nov 2015, 12:28

Hallo nochmal,

vielen Dank für den Hinweis, allerdings lag es doch an der Konfiguration von PHP und NGINX in der Jail.
Falls jemand ähnliche Probleme mit der Installation hier meine Vorgehensweise (Kombination mehrerer Guides):

Install NGINX
cd /usr/ports/www/nginx && make config-recursive

make install clean

A dialog box will popup asking what modules to add when compiling nginx, check the following in addition to the defaults:
HTTP_DAV, HTTP_GZIP_STATIC, HTTP_PERL, HTTP_SSL, HTTP_DAV_EXT

On future dialog boxes, accept the defaults.

Next, run the following to install PHP5:

cd /usr/ports/lang/php5 && make install clean

A dialog box will popup, asking what options to add when compiling PHP. In addition to the defaults, select:
FPM

On future dialog boxes, accept the defaults.

Important: Select socket in process of installing the php extensions:

cd /usr/ports/lang/php55-extensions/

make config

select socket
make reinstall clean


Configuring PHP:

To configure PHP, copy the sample PHP config into production with the following command:

cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
Next, you need to edit php.ini with this command:

ee /usr/local/etc/php.ini

Then find the following in php.ini:
Code: Alles auswählen
output_buffering = 4096
;session.save_path = "/tmp"
upload_max_filesize = 2M
post_max_size = 8M
date.timezone = America/Los_Angeles

And set them to something along these lines:

Code: Alles auswählen
output_buffering = OFF
session.save_path = "/tmp"
upload_max_filesize = 5120M
post_max_size = 5120M
date.timezone = America/New_York

Configuring PHP-FPM:

Next, you must edit the PHP-FPM configuration, run the following command:

ee /usr/local/etc/php-fpm.conf
Replace the default config with the following:

Code: Alles auswählen
[global]
pid = run/php-fpm.pid

[PYDIO]
listen = /var/run/phph-fpm.socket
listen.owner = www
listen.group = www
listen.mode = 0666

listen.backlog = -1
listen.allowed_clients = 127.0.0.1

user = www
group = www

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 500

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp


Then you must edit the fastcgi_params file with this command:

ee /usr/local/etc/nginx/fastcgi_params
And replace the default contents of the file with this:

Code: Alles auswählen
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_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $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  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

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;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;


Now you can start PHP-FPM with this command:

service php-fpm start


Configuring nginx:

To edit the nginx configuration, run the following command:

ee /usr/local/etc/nginx/nginx.conf
Then replace the default config with the following:

Code: Alles auswählen
user  www;
### Change the number of workers to the same number of cores your server has
worker_processes  2;

pid        /var/run/nginx.pid;

events {
        worker_connections  512;
}

http {
        include       mime.types;
        default_type  application/octet-stream;
        index index.php index.htm index.html;
        log_format  main        '$remote_addr - $remote_user [$time_local] "$request" '
                                                '$status $body_bytes_sent "$http_referer" '
                                                '"$http_user_agent" "$http_x_forwarded_for"';

        # GENERAL
        ignore_invalid_headers  on;
        sendfile                off;
        server_name_in_redirect off;
        server_tokens           off;

        #SSL
        ssl_session_cache    shared:SSL:10m;
        ssl_session_timeout  10m;
        ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
        ssl_prefer_server_ciphers   on;
        ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;

        # TCP
        tcp_nodelay off;
        tcp_nopush  on;

        # Timeouts
        client_body_timeout   65;
        client_header_timeout 65;
        keepalive_timeout     65 65;
        send_timeout          65;

        # Compression
        gzip              on;
        gzip_buffers      256 8k;
        gzip_comp_level   9;
        gzip_http_version 1.0;
        gzip_min_length   0;
        gzip_types        text/css text/javascript text/mathml text/plain text/xml application/x-javascript application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml;
        gzip_vary         on;
        gzip_disable      "MSIE [1-6]\.(?!.*SV1)";


        server {
            root         /usr/local/www;
            listen       80;
            server_name  localhost;
           location / {
            }

            #error_page  404              /404.html;

            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
            root   /usr/local/www/nginx-dist;
            }
                # Stops the annoying error messages in the logs
                location ~* ^/(favicon.ico|robots.txt) {
                         log_not_found off;
                }

                # WebDAV Rewrites
                location /shares {
                        if (!-f $request_filename) {
                                rewrite ^/shares /dav.php last;
                                break;
                        }

                        if (!-d $request_filename) {
                                rewrite ^/shares /dav.php last;
                                break;
                        }
                }

                # Enables PHP
                location ~ \.php$ {
                        fastcgi_pass unix:/var/run/phph-fpm.socket;
                        try_files $uri =404;
                        fastcgi_param HTTPS on;
                        include fastcgi_params;
                }

                # Enables Caching
                location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
                        expires 7d;
                        add_header Pragma public;
                        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
                }
        }



Nun muss noch per UI von FreeNAS der Cronjob hinzugefügt werden.
Als Befehl verwende ich:
Code: Alles auswählen
wget -q http://IP_ADRESSE_DER_JAIL/index.php?timerrun=1
Beldion
 
Beiträge: 3
Registriert: Mi 11. Nov 2015, 00:38


Zurück zu Allgemeine Diskussion

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast