Mount services into caddy with directories - reverse-proxy

I want to host a few services (currently cal/carddav, synthing and popfile) on my local pc and share them to the local network without having to care for ports. I am using Caddy as a reverse proxy.
So, I'd like localhost:5232 to be accessible as https://myhostname.local/radicale and similar mappings for the other services.
However sudo caddy reverse-proxy --from myhostname.local/radicale --to localhost:5232 gives reverse-proxy: paths are not allowed: myhostname.local/radicale.
What do I have to do?

The caddy reverse proxy command is very limited and doesn't work with paths. To use paths you would need to setup a caddyfile similar to the one below. You'll need to repeat the second line changing the path and port for each service.
Filename: caddyfile
myhostname.local
reverse_proxy /radicale localhost:5232
From now on start caddy with sudo caddy start

Related

Apache route subdomain to nginx on port?

I have a server running CentOS 7 that has an Apache web-server running on port 80. I am also using a common open-source Git project called GitLab, which uses the nginx web-server instead of Apache. I have configured GitLab's nginx to run on port 4444.
I have a subdomain "git.mydomain.com" that I would like to forward to "mydomain.com:4444" however I would like the URL to continue saying "git.mydomain.com".
I belived that I need to have an Apache VirtualHost file, however I'm not sure what to do.
Is this possible? If so, how can I do so?
Thanks
You would indeed need a git.mydomain.com VirtualHost with a proxy/reverse proxy directive. See https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

Nesting variables in Apache config

I'm building a Docker-based Apache proxy, and I'd like the proxied port to be configurable.
I link the containers with --link ...:proxied, so Docker makes the environment variables PROXIED_PORT_80_TCP_ADDR and PROXIED_PORT_80_TCP_PORT. I used ProxyPass / "http://${PROXIED_PORT_80_TCP_ADDR}:${PROXIED_PORT_80_TCP_PORT}/" to reverse proxy to port 80.
I'd like the port to be configurable from the command line, when I start the container. I pass the variable as -e "PORT=...", and it is usable as ${PORT} in the Apache config.
I've tried to nest the variables, like ${PROXIED_PORT_${PORT}_TCP_ADDR} without success, and also using the Define plugin, but still no luck.

How to configure nginx with SSL?

I am trying to configure ssl for the nginx load balancer , I see three different kinds of configuration files and I am not sure where the certificate and key file should be configured
These are
nginx/sites-available/default
nginx/sites-enabled/myDomain
nginx/nginx.conf
What are these configuration files? where should ssl be ideally configured?
It sounds like you don't know a lot about Nginx. I would start with the docs.
http://nginx.org/en/docs/
nginx/nginx.conf
This is the main Nginx config file and should not contain site-specific configurations (like SSL)
nginx/sites-available/default
This is where you configure your site (and your SSL settings). The default config is simply named "default".
nginx/sites-enabled/myDomain
This is the location that Nginx looks in for sites to serve to users. Typically, you create a symlink from here to the sites-available directory, like below.
sudo ln -s /etc/nginx/sites-available/yourconfig /etc/nginx/sites-enabled/
This allows you to easily activate/deactivate sites by just adding/removing a symlink.

reverse proxy apache to localhost server

I've got a web app running on localhost:3000. I also have an apache server. I would like to reverse proxy the apache server so that requests to /mywebapp get forwarded to the server running on localhost:3000.
I currently have the following config at the bottom of my httpd.conf file, but I'm getting a server error when I try to access it:
ProxyPass /mywebapp http://localhost:3000
ProxyPassReverse /mywebapp http://localhost:3000
Edit - further details:
I'm running a jetty server with java -jar myapp.jar. I'd like to forward requests to an apache server listening on :80 to the jetty server.
I've got mod_proxy_http.so and mod_proxy.so enabled.
I can tell the server is running on localhost - it responds to curl with the appropriate http response. So I'm pretty sure the issue is with my apache setup, but I can't think what the problem would be.
Apache conf file in conf.d for reference: http://pastebin.com/vhXwjbQe
And I've got this in my httpd.conf:
Include conf.d/*.conf
It's hard to give a generic answer because every situation is different so here are some debugging questions to ask yourself:
if the protocol and port correct on the internal service, http and 3000.
Is the service actually listening for connections from localhost? is it running in a docker container etc that would require it to be listening on a different interface? You can check for this by looking at the output from mywebapp's logs and see if the request are making it through the proxy.
Do the paths on the internal service include the prefix that is being passed to Apache or does apache need to strip these off. if for instance mywebapp expects the path "/foo/bar" and apache's reverse proxy is sending it with the context path included "/mywebapp/foo/bar" then it will not match any path in mywebapp.

SVN: remote access isn't working

I've installed subversion and apache on my pc. I can access to my repository using followinf url
http://localhost/svn/repos/
Now I want other members of my group to access the project files I've put in my repository. As it's my first time using svn I looked for the solutions and I think I'm a bit lost.
I read about port forwarding in my router so I opened my router interface. I went to NAT/PAT section of my router configuration and added a new rule with following caracteristics:
Application: svn
External port:3690
Internal port:80
protocol : TCP
equipment: myPC
And Checked the option "Active". But I think I'm missing something.
I read in an article that to verify if the remote access is working i have to go to
svn://83.200.108.71
While it doesn't work. "unable to connect.."
Can someone please help me .
Wait... You can access your repository via http://? Why not let others access the repository using http://?
Don't do anything with your router. Don't muck with ports. Apache httpd is serving your repository just fine off of Port 80. Tell your users to simply access your repository via http://<machineName>/svn/repos. That's all there is to it.
svn:// is a completely different protocol than http://. Port 3690 just happens to be the default port of svn://, but that doesn't mean if you reroute your http:// protocol there, everything will work.
Most of the time, people who first use Subversion set up the svnserve server instead of Apache httpd because it's easier than using Apache http. Here's how you setup a repository to use svn://:
$ svnadmin create my_repos #
$ vi my_repos/conf/svnserve.conf #Need to denop 'password-db=passwd' line
$ vi my_repos/conf/passwd #Need to setup user accounts
$ svnserve -r my_repos -d
And that's it. Now your users can access the repository via svn://<machineName>.
Although svnserve is simpler and easier than Apache (and faster), there are many reasons to use Apache httpd over svnserve:
Port 80 is likely not blocked by network while port 3690 maybe blocked
You can let Apache httpd use LDAP for authentication (which can also allow Windows Active Directory authentication)
Apache httpd can service multiple repositories while svnserve can only service a single repository on port 3690.