Search code examples
phpapachedrupal-7wampwampserver

How to access localhost/drupal from the internet?


I have created a simple website whose url is localhost/drupal. But I couldn't access it from the internet. (i,e from another laptop connected to my home router). I have all settings in the httpd.conf file under Apache set correctly as instructed. i,e "Require all granted" is set. I use Apache 2.4.9 and Latest wamp. I.I use drupal 7.14.

I try to access the url by "internalIPaddress/drupal" i,e 192.168.2.10/drupal. also tried typing just 192.168.2.17 from the other laptop on my home network.nothing seems to workout.!! Pls assist.!!

How to access the site from outside the network.


Solution

  • Download and install ngrok. It's free.

    Then, from your terminal (assuming your drupal site runs on port http://localhost:8888/).

    $ ngrok 8888
    

    ngrok will assign you a subdomain for you. Open the url, and you are good to go.

    You can also sign up for free to be able to choose a name for your subdomain.

    $ ngrok -subdomain=mysubdomain 8888 # ngrok will assign you http://mysubdomain.ngrok.com/
    

    Update

    As of ngrok 2, you need to type http PORT_NUMBER

    $ ngrok http 8888
    

    OR

    $ ngrok http -subdomain=mysubdomain 8888