Sunday, June 18, 2017

Sharing a local website inside a local network

Contents

Preparation for coding:
1. Virtual box and Vagrant

2. Install Apache

3. Install MySQL

4. Install PHP

Edit crawler
1. Download and configure for PHPcrawl

2. Editing code of the crawler

3. Save fetched information in a database.

4. Sharing a local website inside a local network (optional)

5. User interface

If you use Vagrant, you can share a local website inside a local network. At first, check the IP address that you are using. Do "ipconfig" command on your command prompt:


IP address related information will be displayed:


The information you have to check is the IP address that is surrounded by a red square. This is called host address. My host address is 192.168.11 according to this information.

 And add a number, that is not used by other device, to this host address. I will add "151" to the host address because 151 is seemingly not used by other device. So my address for the virtual device would be "192.168.11.151". We will add this information to the Vagrantfile.

Add this line to the Vagrantfile:
config.vm.network "public_network", ip: "192.168.11.151"

like this:

Save and close the file. Then do "vagrant reload" (if your virtual machine is already running) or  "vagrant up" on the command prompt.

If you want to access to the website from your phone, please make sure your phone is connected the wifi network:


The website (or virtual machine) can be accessed from any devices that are inside the local network. Just write the IP address that was specified in the Vagrantfile and press Enter. The website can not be accessed from outside of the local network.

From my phone:


From my PC: