user3607134
user3607134

Reputation: 108

Hosting a php website on an internal local network

I have four windows PCs wirelessly connected to a local network and I want to host my PHP website on a server so that all PCs connected to the server can access web applications via an IP address.

Upvotes: 1

Views: 6369

Answers (2)

Mickel Chowdhury
Mickel Chowdhury

Reputation: 39

At first connect the PCs in network using router.

here is diagram

                _____________
                |   Router  |  Router IP 10.0.0.2
                |           |
                -------------
                 ;   ;   ;   ;
                ;     ;   ;     ;      
               ;       ;    ;       ;     
              ;        ;      ;         ;   
             ;         ;         ;           ;   
            ;           ;            ;            ;  
           ;             ;              ;                ;   
_____________       _____________      ______________     ___________
|   PC 1    |       |   PC 2    |      |    PC 3    |     | PC 4    |
|           |       |           |      |            |     |         |
-------------       -------------      --------------     -----------
IP 10.0.0.2         IP 10.0.0.3        IP 10.0.0.4         IP 10.0.0.5

Server PC           Client PC          Client PC           Client PC  

This IP should
always be
static

Steps Below

  1. Always use Ethernet connection for server pc to router connection

  2. get the MAC address of server PC

in Router

  1. Login into Server

  2. Go to LAN Settings menu add the static IP 10.0.0.2 with server MAC address

  3. Go to Port forwarding menu and forward port 80 and 8080 towards IP 10.0.0.2

in Server PC

  1. Install apache server for PHP hosting

  2. Go to httpd.conf file and find the code

    AllowOverride All
    
    #
    # Controls who can get stuff from this server.
    #
    # Require all granted
    # onlineoffline tag - don't remove
     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost
    

Add this code below after "Allow from localhost"

Allow from 10.0.0.2
Allow from 10.0.0.3
Allow from 10.0.0.4
Allow from 10.0.0.5

You can increase the client PC and add the IP into the server httpd.conf file

Now it is the time for celebrating

  1. Open Client PC Browser
  2. Type url http://10.0.0.2/ in browser's address bar and press enter
  3. Wait some time
  4. Bingo

Upvotes: 2

iTech
iTech

Reputation: 18460

There is no much difference between hosting your server on local network or on external server it all come down to the following general steps:

  1. Install your webserver e.g. Apache and ensure it has the php extension active (default)

  2. Make sure that your webserver binds to the correct IP (e.g. 192.168.1.xx or 0.0.0.0 to be accessible from outside the network)

  3. Make sure that the firewall (both on the server and client) allows the communication (IP and port)

Upvotes: 0

Related Questions