1

I am running a development environment with WAMP and hosts file modified accordingly, such as http://mylocalwp.

I'd like to allow users over the Internet to be able to access the site using a public IP address (assigned by my ISP)..... ** BUT ** currently Apache is configured to point to localhost as 127.0.0.1 along with other names always pointing to 127.0.0.1 (also mylocalwp BTW), by means of vhosts.....

For instance, hosts file has:

::1       localhost
127.0.0.1 localhost
127.0.0.1 tglocal
127.0.0.1 mylocalwp
127.0.0.1 anotherwp

Then Apache vhosts.conf has multiple entries like:

 </VirtualHost>
    <VirtualHost *>
    DocumentRoot "E:\Users\myuser\wordpress\mylocalwp"
    ServerName mylocalwp
    <Directory "E:\Users\myuser\wordpress\mylocalwp">
        Order allow,deny
        Allow from all
      </Directory>
  </VirtualHost>

I'd like to open the firewall and setup traffic from port 80 to local IP address where WP is running (WAMP server), however I'am afraid it won't work as WP's settings hold http://mylocalwp as the base URL.

Is there a way to trick this?

0

Firstly, you're essentially setting up a mini web host at home. I wouldn't advise this; aside from (potentially) being against your ISP's terms and conditions, you also want to be really sure you're not opening up security holes to your local machine.

Having said that, you just need to ensure that as well as listening on your local IP, Apache is also listening on your internal networked IP. Most likely it's already doing this, and you can test it by visiting http://192.168.0.5 (replace with your internal IP) from another machine on your network (eg. a phone on wifi). This is also the IP you'd be putting into your router to forward port 80 traffic through.

Of course, this isn't going to work with your vhosts, so if you're hosting multiple sites on this machine, you'll need to configure the site you want visible as the default site. Alternatively, you can grab a cheap domain from somewhere (that comes with DNS hosting) and set up an A record to point to your public IP. Then just add that domain as one of your vhosts!

  • I agree with all your points of view. The only reason to achieve this is to allow clients to test the development site on the fly, as currently the official file online is always not updated. I am using duplicator plugin to refresh online version however it takes time and sometimes you have made some updates and you wish your customers to pop in quickly. So for the security reasons you pointed out, the local site would be open and visible only rarely, possibly when on the phone with the customer. Once down, turn on the firewall and stop operations! – Riccardo May 31 '16 at 5:13
  • @Riccardo Makes sense. I've done it myself before as well ;) Did this help? Have you been able to get it to work remotely? – Tim Malone May 31 '16 at 5:27
  • 1
    Now I am jogging! 7am here, once back I'll test this! – Riccardo May 31 '16 at 5:29
  • @Riccardo Hey, glad it worked! – Tim Malone May 31 '16 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.