I want to run multiple onion services on one laptop . my questions are.. where is the optimal place to keep a separate directory for each onion service? how do i know which ports to use, which ports are available and ideal to use for multiple onion services ? and basically how to configure the torrc file for these needs
Ports are available as per your localhost - try setting not 127.0.0.1/24 on your loopback interface - but like 127.0.0.1/16 - if you need more than 256 equal ports. After that just map your ports to localhost - or to remote "hosts" like real ones, docker containers and/or virtual machines. It's safe to have a folder like
hs inside your Tor directory - and there's no big difference in distributing them across the file system because if the Tor host process is breached - then your hidden services' data can be leaked with equal difficulty. You can distribute them - if it fits your setup better - not a problem at all. To know which posts to map/use you need to examine your hidden service's workflow: what it will do? For example - for a web server use ports 80 and 443(https is a must for http2 acceleration), for SSH host you will choose a port 22 e.t.c.