To set up Caddy for serving a Single Page Application (SPA) like a React app with react-router, you need to handle routing such that all navigation requests are routed to index.html
, while also serving the static assets correctly.
8 posts tagged with "docker"
View All TagsSetup Caddy for Minio
In this guide, we'll configure Caddy to serve as a reverse proxy for Minio, an object storage server. This setup will allow you to access the Minio console and the object storage service through Caddy.
Caddy Configuration
storage.xiaohai-huang.net {
redir /minio-console /minio-console/
handle_path /minio-console/* {
reverse_proxy my-minio-server:9001
}
handle_path /* {
reverse_proxy my-minio-server:9000
}
}
You can remove the redir
line if the Minio container specifies the console path as /minio-console/ (the trailing slash is needed)
Conclusion
With this configuration, Caddy will route traffic to the appropriate Minio services, making it easy to manage your object storage setup.
Serve Static Website Stored On Remote Server Using Nginx
I stored the build
folder of react app on my MiniO server under the path https://storage.xiaohai-huang.net/website/build/index.html
. I want to serve the web app using a custom domain pxd.pink
. Here is how I achieve this with the help of Nginx.
Host a MinIO Server with Nginx as Reverse Proxy
This documentation covers the minimum settings required to configure NGINX to proxy requests to MinIO.
Given domain storage.xiaohai-huang.net
- Proxy requests to
https://storage.xiaohai-huang.net
to the MinIO S3 API server listening onhttp://my-minio-server:9000
- Proxy requests to the subpath (
/minio-console
) of the domainhttps://storage.xiaohai-huang.net/minio-console
to the MinIO Web Console listening onhttp://my-minio-server:9001
Host | Container |
---|---|
https://storage.xiaohai-huang.net | http://my-minio-server:9000 |
https://storage.xiaohai-huang.net/minio-console | http://my-minio-server:9001 |
How to Setup a ShadowSocks VPN Server?
A fast and reliable VPN server.
Self-Hosted typesense Service
typesense is a open source Algolia alternative. This blog shows how to run a self-hosted typesense
server on my own server.
CMD vs ENTRYPOINT
The ENTRYPOINT specifies a command that will always be executed when the container starts.
The CMD specifies arguments that will be fed to the ENTRYPOINT.
ENTRYPOINT
can also be overridden using--entrypoint
flagCMD
will be overridden when running the container with alternative arguments (e.g.bash
).
How to Setup a OpenVPN Server?
Just a simple command
docker run -itd --restart always --cap-add=NET_ADMIN \
-p 1194:1194/udp -p 7070:8080/tcp \
-e HOST_ADDR=$(curl -s https://api.ipify.org) \
-v openvpn_conf:/opt/Dockovpn_data \
--name dockovpn alekslitvinenk/openvpn
Then download the config file from the http://<public-ip>:7070
and then import the config file (client.ovpn
) to the vpn client.
Clients: