How to configure Meteor build and run for a Cordova build through NGINX + SSL? -


i have web application used build cordova android app. application built ubuntu server running nginx ssl (mongo hosted on mongolab). on production use nodejs 0.12.x, in dev still use meteor shell.

when build application run command :

meteor build  ../../build/mercanet/ --mobile-settings settings.json --server=https://myip 

when run application on server here command (on prod server use node :

meteor --settings settings.json --mobile-server https://myip --port 3000 

if open browser https://myip can check websocket works nginx configured. if open application in android emulator, fails connect : https://myip/sockjs/info?cb=x3i8q_or0y (cancelled)

i tried without ssl , replace https http in meteor shell , worked, i'm wondering should use https meteorjs , cordova.

for information here content of meteor_runtime_config on cordova :

{"meteorrelease":"meteor@1.2.1", "root_url":"https://myip/", "root_url_path_prefix":"", "ddp_default_connection_url":"https://myip", "autoupdateversioncordova":"ee806cb3e614acbfaad7031f7964c254c9fc7e39", "appid":"1rm26uv1lh7ui31i489b2"}" 

thanks help

it nginx config error. here config works , tha use nodejs websocket, , nginx assets :

upstream my_nodejs_upstream {   server 127.0.0.1:yournodeport;   keepalive 64; }  server {     listen 80;     listen [::]:80;     server_name my_nodejs_server;      root /home/www/project_root;      rewrite ^(.*)$ https://your_hostname$1 permanent; }  server {   listen 443 ssl spdy;   listen [::]:443 ssl spdy;   server_name my_nodejs_server;    root /home/www/project_root;   more_clear_headers 'x-powered-by';    ssl_certificate     /etc/letsencrypt/live/fullchain.pem;   ssl_certificate_key /etc/letsencrypt/live/privkey.pem;    # serve images   location ~* "^/(favicon\.ico|img\/.*\.(jpeg|jpg|gif|png))$" {     root /home/your_deployed_meteor_app/bundle/programs/web.browser/app;     access_log off;     expires 1w;   }    # serve css , js   location ~* "^/[a-z0-9]{40}\.(css|js)$" {     root /home/your_deployed_meteor_app/bundle/programs/web.browser;     access_log off;     expires max;   }    location / {     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;     proxy_set_header host $http_host;     proxy_set_header x-nginx-proxy true;     proxy_http_version 1.1;     proxy_set_header upgrade $http_upgrade;     proxy_set_header connection "upgrade";     proxy_max_temp_file_size 0;     proxy_pass http://my_nodejs_upstream/;     proxy_redirect off;     proxy_read_timeout 240s;   } } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -