How do I enable using custom DNS on my local Ubuntu using Nginx?

I've used Laragon for many months now, and I would like to use a more hands-on approach on creating local websites to test out Laravel and WordPress.

I am using WSL 2 (windows Subsystem for Linux), and using Ubuntu as my "OS". I've installed all the requirement components such as Nginx, PHP 7.4 (along with PHP7.4-fpm), MySQL (Really MariaDB), and WordPress.

I can easily use the localhost to check out my created WordPress site, but I would like to be able to use address like "website.test" or "", like how it is with Laragon when you create a new site.

I believe it should be something in the Nginx Configuration file but I can't seem to find a proper guide online. Most of them are just actually for creating live sites and not hosted on local servers.

Currently, I have on my


server {
    listen 80;
    listen [::]:80;

    root /var/www/;

    index index.html;


    access_log /var/log/nginx/;
    error_log /var/log/nginx/;

    location / {
        try_files $uri $uri/ =404;

and I do have it symlinked to


Any proper guides to being able to use custom DNS on just my local environment?

Read more here:

Content Attribution

This content was originally published by Steve at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: