Allow Access From Other IPs on WAN Network
Posted by: fasterisbest (49.1.169.---)
Date: November 14, 2018 10:36AM

I am trying to allow access to a site from other computers who are logged into my router at 192.168.1.(anything).


I have made the changes to my httpd-vhosts.conf file like so:

<VirtualHost *:8081>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require 192.168.1
</Directory>
</VirtualHost>

However, when I restart Wamp I only get 2 of 3 services running. Apache will not start.
Is there something wrong with my syntax?
Do I need to make changes to the httpd.conf file as well?

Thanks


Wamp 3.1.4 64bit Windows 10



Edited 1 time(s). Last edit at 11/14/2018 10:37AM by fasterisbest.

Options: ReplyQuote
Re: Allow Access From Other IPs on WAN Network
Posted by: RiggsFolly (Moderator)
Date: November 14, 2018 11:03AM

The syntax is

    Require ip 192.168.1

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Allow Access From Other IPs on WAN Network
Posted by: fasterisbest (49.1.169.---)
Date: November 14, 2018 12:20PM

Thanks. That definitely did the trick. All services now running.

In order to access localhost from another device on the network I would then type 'http://localhost:8081" into the other device on the network's browser?

Or would I need to type "192.168.1.(my ip):8081"?

Or am I totally wrong?

Thanks for your help.

Options: ReplyQuote
Re: Allow Access From Other IPs on WAN Network
Posted by: Otomatic (Moderator)
Date: November 14, 2018 01:14PM

Hi,

You have manually changed the port dedicated to the http protocol, port 80, to port 8081 in your VirtualHost, but did you also tell Apache to listen on port 8081 in addition to port 80?
No, you didn't, so how do you want to access this Virtualhost on port 8081?

With Wampserver, you should not add "ListenPort" by hand directly in the httpd.conf file or httpd-vhosts.conf. You MUST use the Tools menu item "Add a listen port to Apache".

This is because additional listening ports are managed by Apache variables like this :
Define APACHE24 Apache2.4
Define VERSION_APACHE 2.4.37
Define INSTALL_DIR j:/wamp
Define APACHE_DIR ${INSTALL_DIR}/bin/apache/apache${VERSION_APACHE}
Define SRVROOT ${INSTALL_DIR}/bin/apache/apache${VERSION_APACHE}
Define MYPORT8082 8082
Define MYPORT8081 8081
then
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
Listen 0.0.0.0:${MYPORT8082}
Listen [::0]:${MYPORT8082}
Listen 0.0.0.0:${MYPORT8081}

Similarly for VirtualHost, you must create them after adding additional listening ports to get, for example, a definition of VirtualHost like this:
#
<VirtualHost *:${MYPORT8081}>
	ServerName mysite
	DocumentRoot "j:/wamp/www/phpbb3"
	<Directory  "j:/wamp/www/phpbb3/">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local
	</Directory>
</VirtualHost>

In the alternative, why do you want to use port 8081?

If you cannot use port 80, the replacement port is 8080 and this MUST be done by the tools integrated in Wampserver:
Right-click -> Tools -> Use a port other than 80

In this way, the replacements of port 80 by 8080 are done wherever it is necessary, which you cannot do if you do it manually, as you do not know where it needs to be changed.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Allow Access From Other IPs on WAN Network
Posted by: fasterisbest (49.1.169.---)
Date: November 14, 2018 01:37PM

Thanks for your help. I understand.
I have used the tools menu to change the listening port back to 80. My httpd.conf and httpd-vhosts.conf files now show port 80 (as I changed them through the tools menu).


# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.1
</Directory>
</VirtualHost>



#htttpd.conf

#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80


So to access localhost/(my-site) on the machine running WAMP FROM another device connected to to same WAN what should I type in the browser?

"[localhost];?


"[192.168.1.(wamp-ip-machine)];?


I'm a little confused and can't seem to produce any results.

Thanks again



Edited 1 time(s). Last edit at 11/14/2018 01:54PM by fasterisbest.

Options: ReplyQuote


Sorry, only registered users may post in this forum.