How to make a web-server on Windows accessible to others
After installing the web server, you may need to make it available to others on the local or wide area network. It may be necessary, for example, to test your site on different platforms (see how the site looks on mobile phones) or if you created a service (file sharing, chat, etc.) that should be accessible to others.
Local and global computer networks
To achieve the desired result, you need to know that computer networks are local and global. Example of a local network: a home router to which computers and mobile devices are connected. A global network is the Internet.
The global network and local networks differ by IP addresses. Each network device on any network must have its own unique IP address. The peculiarity of IP addresses in the global network is that they are unique on a global level, therefore devices that have the same IP cannot be connected to the Internet. In local networks IP addresses are also unique, but they are unique only at the local level: i.e. in your home network only one device may have an IP address, for example, 192.168.0.2, otherwise it will cause problems; but other users who have their own local networks, in these networks can also use the IP address 192.168.0.2.
Since local networks are not directly connected to each other, there is no collisions between the same IP addresses. Communication between local networks can occur during the connection to the WAN (Wide Area Network – global network). The connection is performed via devices that have a global IP.
Note: I know about NAT (a technology that allows several devices to have an Internet connection through one IP address), about connecting local networks using another local network, about tunneling, etc., but deliberately skip this for simplicity.
Local and global IP addresses
In order not to get confused in terminology, the global IP address is also called ‘external’, ‘white’; these are different designations of the same.
Local IP address is called ‘internal’, ‘gray’, ‘private’; it's all the same.
The work of the home (local) network, in which there is a router and several devices connected to the router, usually looks like this:
- The router connects to the ISP. The ISP assigns an external IP address to the router, which allows you to establish connections to the global Internet.
- Computers via cable or Wi-Fi, as well as mobile phones via Wi-Fi connect to the router. The router distributes local IP addresses to them.
- If two devices on the local network want to exchange data, then they do this via a router, but network packets are not sent to the WAN.
- If any device needs to connect to the Internet", it will send a corresponding request to the router, the router will connect to the desired node on the WAN, the router will receive a response from the node in the WAN and transmit this response to the device on the local network that made the initial request.
How to open web-server for other computers on the local network
By default, the Apache web server is configured to respond to all who are trying to connect to it. The easiest way to connect to a computer, and, consequently, to a web server, is via IP address.
If you want to open the local web server page on another device (computer, phone) connected to the same local network, it is enough to type the IP address of the computer on which the web server is running in a web-browser.
How to find out the local IP address
But to do this, you need to know which IP address has the computer with a web-server. As already mentioned, the router distributes local IPs. Local IPs can be in the following ranges:
- 10.0.0.0 – 10.255.255.255
- 100.64.0.0 – 100.127.255.255
- 172.16.0.0 – 172.31.255.255
- 192.168.0.0 – 192.168.255.255
And, if you did not change the settings of your router, the most commonly used range is 192.168.0.0 – 192.168.255.255. Most likely, your computer has an address looks like 192.168.0.* or 192.168.1.*. But which one?
In Windows, to find out the local IP address, open a command prompt (press Win+x, and select Windows PowerShell). In the window that opens, run the command
You probably will have fewer network devices, than I have, for all of them will be displayed information, including IP addresses.
My computer has a local IP address of 192.168.0.90. If I, for example, in smartphone, connected via Wi-Fi to the router, enter 192.168.0.90 in A web-browser, I will get the web page of my local web server running on the computer (yes, I have a mess):
Note: if you cannot reach the web server, although the IP address is entered correctly, then try disabling the firewall. If this helped, then the firewall can be enabled, but configure an exception for port 80.
Everything is pretty simple, but there is a problem: after restarting the computer, the IP address is likely to change. Therefore to reopen the local web server you will need to check the IP address and tell it to others who want to visit your local website.
As already mentioned, the local IP address ‘distributes’ by the router. Addresses are arbitrary within this subnet.
To fix the situation with constantly changing local IP, let us get acquainted with such concepts as dynamic and static IP addresses.
Dynamic IP address is given arbitrarily (by a router, ISP). It can change with subsequent connections.
Static IP address is assigned to the network interface (in fact, it is assigned to a computer, a mobile phone). It does not change during subsequent switching.
On the local network, dynamic IP addresses are used by default, but it's easy to change.
There are at least two ways to change the dynamic local address to a static local address:
- in the settings of the network interface (on the computer, in the mobile phone)
- in the settings of the router
There is no need to make changes in both places, just make the settings either on the computer or in the router. You can select any method.
Configuring Static IP in Windows
To configure a static local address on your computer, open ‘Network Connections.’ The easiest way to do this is typing in the Windows command line:
Select the network adapter you are interested in (network connection), right-click it and select ‘Properties’:
In the window that opens, select ‘Internet Protocol version 4 (TCP/IPv4)’ and click the ‘Properties’ button:
You will see the following:
Switch to ‘Use the following IP address’.
Now you need to fill in all the fields. The first three fields are interconnected and are also associated with the router. When we previously looked at our local IP address, we were also shown information such as the Subnet Mask (in my screenshot it is 255.255.255.0) and the Default Gateway (in my screenshot it is 192.168.0.1). Look at your values (it is likely that they will be the same) and enter them in the ‘Subnet Mask’ and ‘Default Gateway’ fields. By the way, the default gateway is the address of the router. Very often the local addresses of the router are 192.168.0.1 and 192.168.1.1
In the IP address field, enter the desired IP. It must match your network. Therefore, if the router has IP 192.168.0.1, then the computer must have an IP of the form 192.168.0.* (for example, 192.168.0.100), if the router has IP 192.168.1.1, then the computer must have an address of the form 192.168.1.* (for example, 192.168 .1.100).
To avoid problems, devices on the same local network should not have the same IP address.
For DNS servers (‘Preferred DNS server’ and ‘Alternate DNS server’), enter 22.214.171.124 and 126.96.36.199, respectively.
At me it turned out so (for the computer I chose IP 192.168.0.100):
Close the windows while saving the settings.
Now each time you connect, your computer will have the same IP address.
Configuring Static IP in the Router
For each router, detailed configuration instructions vary. But the scheme is general: in the the local network settings, go to the DHCP server settings, select the desired computers/phones by MAC address and bind them to certain local IP addresses.
How to open a web-server for global access via Internet
Since Apache listens on all network interfaces by default and answers all, it can be assumed that if you enter a global address in your web-browser, we will see our website.
If the cable of the ISP is connected to your computer directly, then, probably, access to the IP address will work (there are nuances with NAT).
But if you use a router, then the IP address belongs to the router. If a request comes from the Internet to the router, it simply does not know to which device on the local network to forward this request. Moreover, most routers have their own web server; it shows the pages with router settings in a web browser.
Therefore, in order your local site to become visible on the Internet, you must configure port forwarding.
Port forwarding is available for LAN settings and for Internet connection settings (WAN), we need the second one.
In the router go to the Internet settings (WAN), find there Port forwarding. Some routers support Port switching, but this does not work for us.
As the forwarding port, select 80, enter the local IP address of the computer on which the web server is hosted and enter the port to which the redirect will occur, it is port 80, protocol is TCP.
Now my web server is also accessible by external IP:
By the way, to find out your external IP address go to this page: https://suip.biz/en/?act=myip
How to make the global IP address static
You will encounter the same problem as for the local IP address: most likely, your external IP address is dynamic and will change from time to time. If you need a static IP address, then, most likely, it will have to be purchased from your Internet provider as an additional service with a monthly subscription fee.
- How to install web server on Windows 10 (Apache 2.4, PHP 7, MySQL 8.0 and phpMyAdmin) (71.9%)
- Creating Apache Virtual Hosts on Windows (71.9%)
- Kali Linux web server shows blank pages (SOLVED) (69.3%)
- How to install Apache, PHP, MySQL, and phpMyAdmin on Windows XP (65.9%)
- Online Kali Linux programs (FREE) (62.1%)
- How to hack routers in Windows (Router Scan by Stas’M manual) (RANDOM - 2.7%)