How to Use Nginx Map to Block Referrer Spam on Your VPS

nginx map to block referrer spam

Open your analytics after a quiet weekend and you might find visits from domains you have never heard of, linking to pages that do not exist on your site. That is referrer spam: junk traffic sent by bots that forge the HTTP Referer header so their domain shows up in your reports. It brings no … Baca Selengkapnya

How to Set Up a Maintenance Page in Nginx That Shows During Deploys

maintenance page in nginx

Deploys break things. A migration runs long, a file upload stalls halfway, or a config change takes the site down for two minutes while visitors stare at a browser error. A maintenance page in Nginx turns that window into a clear message instead of a broken site: a short page that says the site is … Baca Selengkapnya

What Is Nginx Worker Connections and How Many Do You Actually Need?

nginx worker connections

Open the Nginx config on almost any VPS and you will find a harmless-looking line: worker_connections 1024;. Most people ignore it until their site starts throwing 500 errors during a traffic spike. Nginx worker connections is the setting that caps how many simultaneous connections a single Nginx worker process can handle. Set it too low … Baca Selengkapnya

How to Redirect Old URLs to New Ones in Nginx Without Breaking SEO

redirect old urls in nginx

Every site restructure leaves old URLs behind, and every old URL that returns a 404 leaks the ranking value it built up over months or years. Learning how to redirect old URLs in Nginx properly is what keeps that value moving to the new pages instead of vanishing. A redirect is a simple instruction, but … Baca Selengkapnya

How to Add Basic Authentication to an Nginx Site Without a Plugin

nginx basic authentication

Sometimes the simplest lock is the right one. You have a staging site, a client preview, or an admin panel on your VPS, and you need it hidden from everyone except a handful of people. A full login system is overkill, and a plugin is another thing to update. That is where nginx basic authentication … Baca Selengkapnya

Nginx vs Caddy for WordPress: Speed, SSL, and Ease of Setup Compared

nginx vs caddy for wordpress

If you run WordPress on your own VPS, the web server you pick shapes almost everything else: how fast pages load, how SSL certificates get issued, and how much config you have to maintain. Nginx vs Caddy for WordPress is the comparison most self-hosters land on, because the two servers take opposite approaches to the … Baca Selengkapnya

How to Fix Nginx 403 Forbidden Errors on a Fresh VPS

fix nginx 403 forbidden

A fresh VPS, a clean Nginx install, and a browser that says 403 Forbidden. The server is running, the domain resolves, and yet nothing loads. A fix nginx 403 forbidden error usually comes down to a handful of causes, and the error log names the culprit in plain language. Work through the checks below in … Baca Selengkapnya

How to Serve Static Files Faster with Nginx: Expires Headers and Cache-Control

serve static files faster with nginx

Every repeat visitor to your site downloads the same CSS, JavaScript, images, and fonts again unless you tell their browser not to. That wastes bandwidth, and on a small VPS it also wastes CPU serving files that never change. The fix is two HTTP headers, and you can set both in Nginx in about ten … Baca Selengkapnya

Nginx Location Matching Explained: Prefix, Regex, and Exact Matches

nginx location matching

Your Nginx server block looks right, the config test passes, and still the wrong page loads. A request for /api/users lands on your static site, while /images/logo.png gets handed to PHP-FPM. In most cases the cause is nginx location matching, the set of rules that decides which location block handles each request. Those rules are … Baca Selengkapnya

How to Set Up Nginx as a Load Balancer for Two WordPress Servers

nginx load balancer wordpress servers

One WordPress server handles a quiet blog fine. It starts to struggle when traffic spikes, a plugin update goes wrong, or the server needs a reboot during business hours. An nginx load balancer wordpress servers setup fixes that by placing Nginx in front of two identical WordPress servers and splitting incoming requests between them. If … Baca Selengkapnya