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.1.3 32bit & 64bit)
<Apache 2.4.29/2.2.31> <PHP 7.2/7.1/7.0/5.6/5.5/5.4> <MySQL 5.7.19/5.6.39/5.5.28>
<MariaDB 10.2.14> <phpMyAdmin4.8.1> <MySQL Workbench 6.3.10>

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 MySQL 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.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.6 32 bit - Apache 2.4.37 - PHP 7.3.0/7.2.13/7.1.25/7.0.33/5.6.39 - MySQL 5.7.23 - MariaDB 10.3.11
Wampserver 3.1.6 64 bit - Apache 2.4.37 - PHP 7.3.0/7.2.13/7.1.25/7.0.33/5.6.39 - MySQL 5.7.23 - MariaDB 10.3.11
PhPMyadmin 4.8.3 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

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.