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!
Related
There is a Caddy web server in local network listening address https://chat.
A-record (chat - 192.168.10.10) was created in local DNS-server for that local host.
How to configure Caddy for listening https://192.168.10.10:443 as alias?
Current conf file:
https://chat {
bind {$ADDRESS}
tls /var/snap/rocketchat-server/ssl/chat.crt /var/snap/rocketchat-server/ssl/chat.key
proxy / localhost:3000 {
websocket
transparent
}
}
192.168.10.10:443{
redir https://chat{uri}
}
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/;
}
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.
I am trying to test an REST API on my local machine using frisby.js . It throws the following error.
Error: tunneling socket could not be established.
The machine address is something like 'https://machine_name:8443'
It seems that you are behind a proxy. Then, to make your frisby test working, you need to apply proxy configuration as follows:
var frisby = require('frisby');
frisby.globalSetup({
request: {
proxy: 'http://xx.xx.xx.xx:yyyy' // Provide proxy info (host, port) here
}
});
frisby.create('Your spec description here')
.get('https://machine_name:8443')
.expectStatus(200)
.toss();
Note also that you are using HTTPS protocol. Then you may find useful my answer in this post in case you have problems with SSL certificates
Fiddler Error Connecting to HTTPS Applications
Fiddler Log:
!SecureClientPipeDirect failed: Authentication failed because the remote party has closed the transport stream. on pipe to (CN=services.bigpond.com, O=DO_NOT_TRUST_BC, OU=Created by http://www.fiddler2.com)
I have followed other posts but no answers
The typical explanation for this message, as documented in many places, is that the client application has not been configured to trust Fiddler's root certificate. As such, the client closes the connection to Fiddler when it sees the untrusted certificate.
http://fiddler2.com/documentation/Configure-Fiddler/Tasks/TrustFiddlerRootCert
In Kestrel I'm using an SSL cert.
I 'downgraded' the TLS protocol in order to get this to work.
This is not something you'd do in production - but in production you shouldn't be using kestrel. I'm not saying this is the best overall config, but this is mainly to show the SslProtocols option.
WebHost.CreateDefaultBuilder(args)
.UseKestrel(options =>
{
options.Listen(IPAddress.Any, 5000); // http:localhost:5000
options.Listen(IPAddress.Any, 44300, listenOptions =>
{
// https://dotnetthoughts.net/enable-http2-on-kestrel/
//listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http2;
listenOptions.UseHttps(#"S:\WORK\SSL\example.com.pfx", "cert-password", httpsOptions =>
{
httpsOptions.SslProtocols = System.Security.Authentication.SslProtocols.Tls;
});
});
})
.UseStartup<Startup>();