Reveal real IP for Nginx behind a reverse proxy
I'm currently using LogDNA for gathering Nginx logs. However, I can only see IPs from Cloudflare by default in the logs as my server was proxied by Cloudflare. Let's see how to reveal the real IP address of the client in the logs behind such reverse proxy server by using ngx_http_realip_module.
Setup Google Analytics 4 with GTM
Google Analytics 4 is Google's newest version of Google Analytics. Since I'm using the Google Tag Manager, just take a few steps to set up GA4 for my site.
Allowing Cloudflare IP addresses only in Nginx
If your HTTP server is running behind Cloudflare, it is recommended to only allow traffic from Cloudflare IP addresses. We can configure this systematically using iptables. However, it's also flexible to white list Cloudflare IPs just inside the Nginx service.
2020.08.07
Set up a Firewall with UFW
Uncomplicated Firewall (UFW) is a simplified firewall management interface that hides the complexity of lower-level packet filtering technologies such iptables and uftables.
2020.05.19
Get Let's Encrypt certs with HAProxy and Nginx
I have used Nginx virtual host to get Let's Encrypt SSL certificates, it's easy and straightforward. However, when HAProxy was added in front of Nginx, some issues arises. So let's see how to deal with it.
Homebrew 替换国内镜像源
在国内使用 brew 的速度真心不敢恭维,尤其是在 brew update 的时候经常卡住不动。换用 brew update --verbose 你会发现是 git fetch 的速度慢导致的,所以还是要看本地网络连接 GitHub 的速度咯。换个镜像源救救急。
Automatically purge Cloudflare cache after Netlify build
Although Netlify provides CDN service, Cloudflare has more edge locations around the world. What's more, Netlify hosted sites are hardly reached in China, while Cloudflare still lives. With this in mind, I decided to switch to Cloudflare for load balancing. However, pushing post/file changes to Netlify did not clear Cloudflare's cache, that's a mess. So, I'm going to use Cloudflare's API together with Netlify's outgoing webhook to make them in the same pace.
2020.05.07
Setup h5ai with Nginx on Ubuntu server
h5ai is a modern file indexer for HTTP web servers with focus on your files. Directories are displayed in a appealing way and browsing them is enhanced by different views, a breadcrumb and a tree overview.