1

I have a python jsonrpc service running in the server on port 8082.

I want to reach it with php jsonRPCClient. (and have to be https)
My nginx server looks like:

server {
    listen   443;
    server_name  service.mydomain.com;
    ssl                  on;
    ssl_certificate      /path/to/crt/domain.crt;
    ssl_certificate_key  /path/to/crt/domain.key;
    keepalive_timeout    70;

    access_log  /var/log/nginx/domain.access.log;
    error_log  /var/log/nginx/domain.error.log;

    location / {
      proxy_set_header   Host             $host;
      proxy_set_header   X-Real-IP        $remote_addr;
      proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

      proxy_pass         http://127.0.0.1:8082;
    }
}


When I type into my browser: https://service.mydomain.com then I see the correct result from service.

But If I call it with php code like:

$rpc = new jsonRPCClient("https://service.mydomain.com");
return $rpc->create_client($client_id);

Then I can't work with it .. and seems from service log that this time the request never reaches the service.

Any Ideas on how to solve this would be very precious.
Thanks
(ps: The keys are self-signed certificates, if it changes something)


The port 80 default nginx setup is

server {
    listen   80 default;
    server_name  www.mydomain.com;

    access_log  /var/log/nginx/localhost.access.log;

    location / {
      proxy_pass         http://127.0.0.1:81;
      proxy_redirect     off;

      proxy_set_header   Host             $host;
      proxy_set_header   X-Real-IP        $remote_addr;
      proxy_set_header   X-Forwarded-Port 80;
      proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
      proxy_max_temp_file_size 0;
    }
}

And the 443 port nginx setup is:

server {
    listen   443;
    server_name  www.mydomain.com;
    ssl                  on;
    ssl_certificate      /path/to/crt/domain.crt;
    ssl_certificate_key  /path/to/crt/domain.key;
    keepalive_timeout    70;

    access_log  /var/log/nginx/domain.access.log;
    error_log  /var/log/nginx/domain.error.log;

    location / {
      proxy_set_header   Host             $host;
      proxy_set_header   X-Real-IP        $remote_addr;
      proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

      proxy_pass         http://127.0.0.1:81;
    }
}

The website is served on port 81 by apache:

<VirtualHost *:81>
   ServerName www.mydomain.com
   DocumentRoot "/var/www/domain"
   DirectoryIndex index.php
   <Directory "/var/www/domain>
       AllowOverride All
       Allow From All
   </Directory>
</VirtualHost>
user227241
  • 11
  • 2

0 Answers0