1

I'm running a virtual machine so I can work with Wordpress; I have a database on my VM Linux machine in VBox and I'm using a Mac. I have to be able to use my mac to go to localhost/wp-admin so I can test code changes to my WordPress templates.

I have created a pf.anchor called com.user.forwarding and it says

rdr pass inet proto tcp from any to any port 8080 -> 127.0.0.1 port 80

my pf.conf file says:

scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
rdr-anchor "org.user.forwarding"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
load anchor "org.user.forwarding" from "/etc/pf.anchors/org.user.forwarding"

in my VBox, with NAT, my settings are:

my settings in VBox

and in my hosts file is:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
127.0.0.1   mywebsite.com
::1     localhost

when I go to localhost:80/wp-admin, I get 'Safari can't open the page "localhost/wp-admin/" because the server where this page is located isn't responding.' My VM has nginx and mariadb running.

I've searched for the sysctl.conf file on my mac and it doesn't exist. I've done everything in here (except play with sysctl file which doesn't exist on my machine)

What's going on???

  • It's a bit difficult to understand what happens on which machine, where Wordpress is running, from where you access it and what sysctl.conf has to do with it. Can you please edit the question to add details? – nohillside Jul 12 at 14:02
  • @nohillside the sysctl.conf is referenced in the link at the end of my OP. but I've also tried doing it thru sudo sysctl -w net.inet.ip.forwarding=1 and that didn't work either. – AviG Jul 12 at 14:34
  • @nohillside I want a certain website to show up when I go to localhost:80/wp-admin – AviG Jul 12 at 14:46
  • We love to help you but we can't see what's on your screen, so please help us to help you. Just saying "it didn't work" don't give us any clues about what's happening, error messages etc. might. Also, if you just want to know about the whereabouts of sysctl.conf please ask exactly that in a separate question (and reference the relating answer so people know what you are talking about). – nohillside Jul 12 at 18:14
  • Also, it's still not clear what is running on your Mac, what is running on your Linux VM, which IP is which etc. – nohillside Jul 12 at 18:17
1

You have created the forwarding rule the wrong way around - i.e. you have reversed it.

Instead of:

rdr pass inet proto tcp from any to any port 8080 -> 127.0.0.1 port 80

It needs to look like this:

rdr pass inet proto tcp from any to any port 80 -> 10.0.2.15 port 8080

In regards to the sysctl.conf file, you'll absolutely need to make that change. It doesn't matter that the file doesn't exist on your computer - just create an empty file (/etc/sysctl.conf) and add those lines.

If you can't get the sysctl.conf file working, you can run the sysctl command manually on the command line:

 sudo sysctl -w net.inet.ip.forwarding=1 
  • Comments are not for extended discussion; this conversation has been moved to chat. – bmike Jul 14 at 2:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .