I try to push stream to facebook from nginx server withi this summary:
- install nginx (with rtmp module) on debian
- nginx.conf
rtmp {
server{
listen 9999;
chunk_size 4096;
application live {
live on;
record off;
push rtmp://live-api.facebook.com:80/rtmp/key;
}
}
}
and error received:
2018/01/23 09:31:10 [error] 6826#0: connect() to [2a03:2880:f002:12a:face:b00c:0:1411]:80 failed (101: Network is unreachable)
2018/01/23 09:31:10 [error] 6826#0: *5 relay: push reconnect failed name='online' app='' playpath='' url='live-api.facebook.com:80/rtmp/key', client: IP, server: 0.0.0.0:9999
Is there something wrong ?
I'm still in searching to resolve this
Thank in advance
replace 'key' from your push URL with your private key found in https://www.facebook.com/live/create
Sometime in peak hour, the facebook RTMP server stop accepting new request. Happened to me so many times while simulcast Youtube/FB Live / Twitch on Nginx RTMP Module.
Another solution is, fire up free tier AWS EC2 AMI Linux, install NGINX with RTMP Module and pushing from there.
Related
I'm new to nginx and docker-compose.
I have a docker-compose which contains a nginx-reverse-proxy and many web APIs called webapi01, webapi02 ...
In nginx-reverse-proxy, I have
location /app1/{
proxy_pass http://webapi01:5000/;
}
location /app2/{
proxy_pass http://webapi02:5000/;
}
and they are working fine.
Now after startup my docker-compose, I want to debug my webapi01 by modifying the location that points to my webApi01 and expecting the request will hit the debug instance webapi01 which is listing at http://localhost:5000
location /app1/{
#proxy_pass http://webapi01:5000/;
# what should be here so the request will be forward to the localhost(the machine, not the docker-compose ) so I can debug my webapi01
proxy_pass http://127.0.0.1:5000/;
}
However, I could not make it work. The log shows the error: connect() failed (111: Connection refused) while connecting to upstream .......
So the question is how to redirect the request from nginx-reverse-proxy back to the host machine (localhost)?
Any help or suggestion would be appreciated.
thanks,
Austin
I found the solution. https://medium.com/#bsamartins/reverse-proxy-nginx-docker-container-to-localhost-7ebc53577192
location /app1/{
# this line will connect to your running instance in docker-compose
#proxy_pass http://webapi01:5000/;
# this line will forward to the localhost(the machine, not the docker-compose ) so I can debug my webapi01
proxy_pass http://docker.for.win.localhost:5000/;
}
We're running a web API app on Kubernetes (1.9.3) in AWS (set with KOPS). The app is a Deployment and represented by a Service (type: LoadBalancer) which is actually an ELB (v1) on AWS.
This generally works - except that some packets (fragments of HTTP requests) are "delayed" somewhere between the client <-> app container. (In both HTTP and HTTPS which terminates on ELB).
From the node side:
( Note: Almost all packets on server-side arrive duplicated 3 times )
We use keep-alive so the tcp socket is open and requests arrive and return pretty fast. Then the problem happens:
first, a packet with only the headers arrives [PSH,ACK] (I see the headers in the payload with tcpdump).
an [ACK] is sent back by the container.
The tcp socket/stream is quiet for a very long time (up to 30s and more - but the interval is not consistent, we consider >1s as a problem ).
another [PSH, ACK] with the HTTP data arrives, and the request can finally be processed in the app.
From the client side:
I've run some traffic from my computer, recording it on the client side to see the other end of the problem, but not 100% sure it represents the real client side.
a [PSH,ASK] with the headers go out.
a couple of [ACK]s with parts of the payload start going out.
no response arrives for a few seconds (or more) and no more packets go out.
[ACK] marked as [TCP Window update] arrives.
a short pause again and [ACK]s start arriving and the session continues until the end of the payload.
This is only happening under load.
To my understanding, this is somewhere between the ELB and the Kube-Proxy, but I'm clueless and desperate for help.
This is the arguments Kube-Proxy runs with:
Commands: /bin/sh -c mkfifo /tmp/pipe; (tee -a /var/log/kube-proxy.log < /tmp/pipe & ) ; exec /usr/local/bin/kube-proxy --cluster-cidr=100.96.0.0/11 --conntrack-max-per-core=131072 --hostname-override=ip-10-176-111-91.ec2.internal --kubeconfig=/var/lib/kube-proxy/kubeconfig --master=https://api.internal.prd.k8s.local --oom-score-adj=-998 --resource-container="" --v=2 > /tmp/pipe 2>&1
And we use Calico as a CNI:
So far I've tried:
Using service.beta.kubernetes.io/aws-load-balancer-type: "nlb" - the issue remained.
(Playing around with ELB settings hoping something will do the trick ¯_(ツ)_/¯ )
Looking for errors in the Kube-Proxy, found rare occurrences of the following:
E0801 04:10:57.269475 1 reflector.go:205] k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/factory.go:85: Failed to list *core.Endpoints: Get https://api.internal.prd.k8s.local/api/v1/endpoints?limit=500&resourceVersion=0: dial tcp: lookup api.internal.prd.k8s.local on 10.176.0.2:53: no such host
...and...
E0801 04:09:48.075452 1 proxier.go:1667] Failed to execute iptables-restore: exit status 1 (iptables-restore: line 7 failed
)
I0801 04:09:48.075496 1 proxier.go:1669] Closing local ports after iptables-restore failure
I couldn't find anything describing such issue and will appreciate any help. Ideas on how to continue and troubleshoot are welcome.
Best,
A
I have caddy installed and running in my CentOS server,mainly I have it to proxy request to 2 Golang applications that I have running and it's working great! Now, I need to serve a static site, but i't returning connection refused
The structure of my directory is:
|--Caddyfile
|--mygolang1
|--mygolang2
|--FolderofMyStaticSite
|-----MySite
|-------Public
|----------index.html
And the caddyfile configuration is
:9000 {
root FolderofMyStaticSite/MySite/
log mySite
}
subdomain1.domain.com {
gzip
proxy / :7000 {
except /assets /robots.txt
}
}
subdomain2.domain.com {
proxy / :8000 {
max_fails 1
}
}
Then when I go to the browser and open xxx.xxx.xxx.xxx:9000 I get connection refused, why port 9000? it's because I have it only for testing not for production but I need a port to hear that site. What Am I missing? Thanks!
I'm getting "Socket Error #10060, Connection timed out" when trying to access a https link.
Here is how you can reproduce it with INDY 10.6.2.0 and OpenSSL 1.0.2d DLLs (also happens with older Indy 10 version and dlls):
create a project and add a TButton, TIdHTTP and TMemo objects to the form
add to button onclick this code:
IdHTTP1.Request.UserAgent:='Indy';
IdHTTP1.HandleRedirects:=true;
Memo1.text:=IdHTTP1.Get('https://www.itv.com');`
now compile and run it, it will download correctly the file.
BUT if you are using a service like www.smartydns.com which redirects DNS request to their server, INDY sample above will not work and fail with "Socket Error #10060, Connection timed out" message.
Have tried it with WGET too (https://eternallybored.org/misc/wget/) and in version 1.13 its initializing the SSL handshake and freezes, but works without problems with version 1.15.
So the question is, what IdHTTP settings do I have to use to make it work, or is it a bug in Indy10 ?
To connect my server with the APN server I use the following code.
// coonecting the apn server
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsPort = 2195;
$apnsCert = 'apns-dev.pem';
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $errorNo, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
But I am failed to connect, I print the $errorNo and $errorString
the output was:
error: Connection timed out
errorNo: 110
But I am also getting the following warnings in errorLog:
Unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /home/riseupla/public_html/applications/apn/apn.php on line 35
What shoud I do?
NOTE:
I can send push notifications by my mac project (using push me baby project).
But my PHP project failed to connect.
You do not say if you run the php from a different machine than your Mac, but if you are using a hosted service for your php site, then it might be that the ISP has blocked port 2195 (and 2196).
Try to run your php on the same machine as you use when running your Mac project and see if this helps. If that's the case, then you ISP has most likely blocked the ports, and you will have to either find a different ISP or have them open the ports.
Claus
You probably solved it.
But for those interested to find out if the ports are blocked: IF you have SSH access to the server a simple way is to check if you can telnet to the server. This way i found out my provider blocked the ports...
:~ telnet gateway.sandbox.push.apple.com 2195
:~ telnet gateway.sandbox.push.apple.com 2196
You should see something like:
Trying 17.172.232.236...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
may be that your server's IP variety, it must be fixed so work!!