1

adjusting nginx files for Wialon Local

Topic: adjusting nginx files for Wialon Local

Hello
I used a Server Wialon Local.
I have a problem in adjusting nginx files, when you change the settings. After the restart nginx, back as it was.
How can I save the settings from loss.
Thank you

2

adjusting nginx files for Wialon Local

Re: adjusting nginx files for Wialon Local

Hello har225,
There is no reason to change file local.conf  because it is generated by wlocal service.
What adjustment do you want to add and where?

Евгений
WDC Administrator
Gurtam
3

adjusting nginx files for Wialon Local

Re: adjusting nginx files for Wialon Local

Thank you for your response
I want to run scripts php, on the home page.

4

adjusting nginx files for Wialon Local

Re: adjusting nginx files for Wialon Local

Default installation of wialon local doesn't  include any php module.
So if you want to run php scripts on the same server do the following:

+ show spoiler

apt-get update
apt-get upgrade
apt-get install php5-fpm

----------------------------------------------
nano /etc/php5/fpm/php.ini

+ show spoiler

cgi.fix_pathinfo=0

--------------------------------------------------------

nano /etc/php5/fpm/pool.d/www.conf

+ show spoiler

listen = /var/run/php5-fpm.sock

-----------------------------------------------------------

+ show spoiler

service php5-fpm restart

------------------------------------------------------------

nano /etc/nginx/conf.d/php.conf

+ show spoiler

server {
        listen   80;


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

        server_name php.lo;

        location / {
                try_files $uri $uri/ /index.html;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
              root /usr/share/nginx/html;
        }

        # pass the PHP scripts to FastCGI server listening on the php-fpm socket
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params.dpkg-dist;

        }

}

---------------------------------------------------------------

+ show spoiler

nginx -t
service nginx restart

------------------------------------------------------------

cat /etc/nginx/fastcgi_params.dpkg-dist

+ show spoiler

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

----------------------------------------------------------------------------

nano /usr/share/nginx/html/info.php

+ show spoiler

<?php
phpinfo();
?>

--------------------------------------

Then check your php page

+ show spoiler

.http://wstaw.org/m/2015/02/16/php.png

Евгений
WDC Administrator
Gurtam
5

adjusting nginx files for Wialon Local

Re: adjusting nginx files for Wialon Local

Hello
Thank you for your attention, now it is working.