That's irrelevant.In this case I'm using Apache.
So it has nothing to do with apache's configuration but jiggling about with /etc/pf.conf ?Through port forwarding or a reverse proxy on the host.
That's irrelevant.
Or IPFW, whatever you prefer.jiggling about with /etc/pf.conf ?
Or IPFW, whatever you prefer.
There's only one downside to using regular port forwarding, you can only forward ports 80/443 once. But if you only have one web server it's a fine solution.
Code:# Public IP address IP_PUB="1.2.3.4" # Packet normalization scrub in all # Allow outbound connections from within the jails nat on em0 from lo1:network to any -> (em0) # webserver jail at 192.168.0.2 rdr on em0 proto tcp from any to $IP_PUB port 443 -> 192.168.0.2 # just an example in case you want to redirect to another port within your jail rdr on em0 proto tcp from any to $IP_PUB port 80 -> 192.168.0.2 port 8080 # mailserver jail at 192.168.0.3 rdr on em0 proto tcp from any to $IP_PUB port 25 -> 192.168.0.3 rdr on em0 proto tcp from any to $IP_PUB port 587 -> 192.168.0.3 rdr on em0 proto tcp from any to $IP_PUB port 143 -> 192.168.0.3 rdr on em0 proto tcp from any to $IP_PUB port 993 -> 192.168.0.3
So using the article and just changing the addresses and the interface name from em0 to vtnet0 should suffice?The david.io article is using it as an example. Your provider should have given you the public IP address. Then you can use, as that david.io article says, a private network such as 192.168.0.x for the jail.
WEBPORT="{ 80, 443 }"
rdr pass on re0 proto tcp from any to $IP_PUB port $WEBPORT -> $WEBJAIL
$ext_if="vtnet0"
rdr on $ext_if proto tcp from any to ($ext_if) port $WEBPORT -> $WEBJAIL
pass in on $ext_if from any to $WEBJAIL port $WEBPORT
rdr and pass rule is because rdr pass will "short-circuit", the traffic is always passed and any other rule is entirely ignored (so you can never block any "bad" traffic).I believe so. Change em0 to vtnet0, use the public address of your VPS, then you can follow the article as written, that is, clone lo1 (which I keep saying in my head as LOL) to the internal addresses and use rdr as shown.
The second. By configuring the web-server you will never make a local IP public accessible.The question is, do I need to configure the webserver differently when in a jail, or do I need to change pf.conf to accommodate access to the jail from the Internet?
/etc/pf.conf seems to work both ways.ext_if = "vtnet0"
jail_ip = "10.0.0.10" # ← change to your jail’s IP
web_ports = "{ 80, 443 }"
# NAT for the whole jail network (so the jail can reach the internet)
nat on $ext_if from 10.0.0.0 to any -> ($ext_if)
# Redirect incoming web traffic to the jail
rdr on $ext_if proto tcp from any to ($ext_if) port $web_ports -> $jail_ip
# Allow the traffic
pass in on $ext_if proto tcp to $jail_ip port $web_ports
pass out all
pass in on bridge0