Using a Proxy

If web traffic flows through a proxy server, that proxy server can likely be used to prevent access to such sites. For example, Squid has an add-on called SquidGuard which allows for blocking web sites by URL or other similar criteria.

In modern environments this is not effective as it works best on HTTP, and not HTTPS. HTTPS can sometimes be filtered via peek/splice to inspect SNI and similar aspects of connections, but even that fails with modern security practices like encrypted SNI. A non-transparent proxy setup is more likely to work correctly, but is more complicated to setup and maintain.