How to run multiple instances of Tor?
- by Ed
I'm trying to set up a special proxy server (running Windows). It will have several instances of Privoxy and Tor running and my app will choose which Privoxy instance to send HTTP requests to depending on the load. Privoxy will then forward them to Tor.
I'm using srvany.exe to create the services. At the moment I'm running 3 Privoxy and 3 Tor services (I copied the binaries to different folders). Each Privoxy service is listening to its own port (8118, 8119, 8120). I can see them listening in a port scanner. This is the application path (for srvany in registry) for the 1st service:
C:\Anonymiser\Privoxy 01\privoxy.exe --service
I've also configured the Tor services to listen to different ports (9050, 9052, 9054). This is the application path for the 1st service:
C:\Anonymiser\Tor 01\tor.exe -f "C:\Anonymiser\Tor 01\torrc"
The problem is, when I start the Tor services, only the first service I start is listening to its port. The others aren't listening. They listen if I run them separately.
Any ideas what could be wrong? How can I make all 3 services listen on their assigned ports?
This is one of my Privoxy configs:
confdir .
logdir .
logfile privoxy.log
debug 1 # show each GET/POST/CONNECT request
debug 4096 # Startup banner and warnings
debug 8192 # Errors - we highly recommended enabling this
listen-address localhost:8118
toggle 0
enable-remote-toggle 0
enable-remote-http-toggle 0
enable-edit-actions 1
buffer-limit 4096
forwarded-connect-retries 0
forward-socks4a / localhost:9050 .
This is one of my Tor configs:
ControlPort 9051
Log notice stdout
SocksListenAddress localhost
SocksPort 9050
EDIT:
Found a workaround. The Tor binary wants a lock on a file in the AppData folder. Because all of them want a lock on the same file, only the first one I start will be working. The workaround is to run each Tor instance under a different account. Not the best solution, but it works.