How to make whitelist access

How to make a allowlist so that only certain public ip can access my website? does anyone have a way?