Accelerate and Secure your Wordpress Installation
ngrok works out of the box with any up-to-date Wordpress installation where you have access to the host machine's terminal and filesystem.
ngrok improves your existing Wordpress installation by:
- Managing and auto-renewing your TLS certificates
- Distributing and accelerating your blog on a global content delivery network
- Protecting your blog from DDoS attacks with our firewall
1. Reserve a domain
Navigate to the Domains section of the ngrok dashboard and click New + to reserve a free static domain like https://your-blog.ngrok.app
or a custom domain you already own.
2. Create a Traffic Policy file
On the system where Wordpress runs, create a file named wordpress.yaml
and paste in the following policy:
Loading…
What's happening here?
This policy rewrites the Host
header of every HTTP request to localhost
so that Wordpress accepts the requests.
3. Start your Wordpress endpoint
On the same system where Wordpress runs, start the agent on port 80
, which is the default for Wordpress, and referencing the wordpress.yaml
file you just created.
Loading…
4. Restrict access to the admin dashboard (optional)
The WP Admin dashboard is protected by a username and password, but is often subjected to attacks.
You can use the restrict-ips
Traffic Policy action to allow only yours or other trusted IPs.
Edit your wordpress.yaml
file with the following policy, replacing $YOUR_IP
.
Loading…
What's happening here? This policy first checks whether an HTTP request's URL contains the /wp-admin
path. If it does, then it applies the restrict-ips
action to allow only the addresses you explicitly added.
Then, as before, the policy rewrites the Host
header of every HTTP request to localhost
so that Wordpress accepts the requests.
5. Try out your endpoint
Visit the domain you reserved either in the browser or in the terminal using a tool like curl
.
You should see the app or service at the port connected to your internal Agent Endpoint.
What's next?
- Read more about Traffic Policy and its core concepts.
- View your Wordpress traffic in Traffic Inspector.
- Use the
rewrite
action to create "pretty" blog URLs.