You can block access to a port on a server with ufw
. man ufw
has a whole raft of examples but assuming it's enabled, it should be like this:
sudo ufw deny out to <<ip address>> port 80
I've just tested this against my own server and it works. Remember that port 443 is used for SSL so that might want blocking too.
Remember, this blocks the whole of port 80 on this server.
If you want to start filtering based on subfolders (allowing some paths but not others) you're going to need something that proxies the requests. A firewall doesn't look at the content, it looks at the connections. To a firewall, a request for /subfolder is the same as a request to /a-different-subfolder.
So what you're looking for is a transparent proxy that you can twist into nixing some of your traffic. Parental-control software is probably your best bet for a quick setup. Something like dansguardian
certainly used to be popular and I would say it warrants exploration. More information is available on the wiki: