Multiple jails on host... How they can access each other.

Hi everyone! I'm new here so go easy on me will yea ;)

I've been using ezjail's and so far everything's worked successfully. I've created the following jails with the following programs inside 'em:

10.0.0.1 - SSH
10.0.0.2 - mysql
10.0.0.3 - lighttpd
10.0.0.4 - php
10.0.0.5 - archives (all web sites will go here)

(It's important to note each jail can access the internet)
And now my question is how do I make some of the jails communicate with each other? Here is what I wanted:

lighttpd -> access -> php
lighttpd -> access -> archives (load websites)
lighttpd -> access -> mysql
etc
etc

I can't seem to find any tutorials that would help; moreover, I tried editing the /usr/local/etc/lighttpd.conf file under fastcgi module and I changed so it looks like:
Code:
fastcgi.server = ( ".php" =>
      ( "10.0.0.4" =>
         ( "socket" => "/var/run/lighttpd/php-fastcgi.socket",
           "bin-path" => "/usr/local/bin/php-cgi-cgi"
      )
)
Unfortunately it didn't work, the lighttpd.error.log basically told me that it didn' work lol. Sorry but I'm kinda' at my wits end, could someone help me? Thanks so much!!
 
Install php in the jail that has lighttpd. It's rather pointless splitting these 2 up.
 
If you want one jail to see a filesystem on another jail you could use mount_nullfs(8). At least that's what i'm doing.

Please reply if this might work for so i can give you the details howto mount_nullfs.
 
Hi everyone and thanks for the help!

Believe it or not, I managed to figure out almost everything, first:

I went into the phpjail and ran a code to load the a PHP-CGI server to host access to php through ip using this code:
Code:
php-cgi -b 10.0.0.4:521
So this line(written into the command prompt) made the phpserver bind to the current ipaddress of the jail and started it up.

Then I went inside the wwwjail and I went to the /usr/local/etc/lighttpd.conf file and I went down to the module and I changed it to look like this:
Code:
fastcgi.server = ( ".php" =>
      ( "localhost" =>
         ( 
           "host" => "10.0.0.4",
           "port" => "521"

           #"socket" => "/var/run/lighttpd/php-fastcgi.socket",
           #"bin-path" => "/usr/local/bin/php-cgi-cgi"
      )
)

Basically making lighttpd access the php from off this jail to another jail! Now if I wanted to access mysql, there's already a mysql server running from a different jail, so I'd just have to access it through IP's somehow (haven't done it yet).

Lastley, lighttpd gave an error about not liking the jail, so went to the very bottom of the /usr/local/etc/lighttpd.conf fileand I commented out the IP4 & IP6 part:
Code:
# Enable IPV6 and IPV4 together
#server.use-ipv6 = "enable"
#$SERVER["socket"] == "0.0.0.0:80" {}
___________________________________________________

So I guess I solved partially the the problem. My last question is how to make lighttpd access another jail with all the websites? ... would I have to use a ftp file server or something?

Thanks all!
(No need to show ifconfig, everythings working perfectly for the internet: I basically assigned every ip address from the firewall to the jail. So when I plan to get the web-server online, I'll make the firewall point and only point to the lighttpd jail ip �e)
 
torr_from_fallout2 said:
So I guess I solved partially the the problem. My last question is how to make lighttpd access another jail with all the websites? ... would I have to use a ftp file server or something?

mount_nullfs(8) as already stated, is probably your best bet. Other than that, you probably could use NFS, it may not be optimal though.
 
torr_from_fallout2 said:
Hi Voltar!

Could you please give me an example with how to link the two directories using 'mount nullfs'.

Thanks!

On the host...

# mount_nullfs /path/to/something /path/to/jail/something


For example if you wanted to mount the ports tree of the host in a jail,

# mount_nullfs /usr/ports /path/to/jail/usr/ports


You can also mount in read only mode with # mount_nullfs -o ro which may be useful in your case if you only want your webserver to be able to read, but not write to the filesystem.
 
Excellent! It all works perfectly! :D

I've managed to put ssh/lighttpd/mysql/website into different jails and it all works :) The problem has been solved.

Thanks again Voltar, that did the trick nicely heh heh heeee. Last question if I may though. How do I unmount a 'mount_nullfs' ? Or how do I sever their link or stop it. Lets say I made two folders and now I want to delete them both, how do I do that? (thanks again!)
 
Back
Top