Access to virtual host from internet
Posted by: einfall (---.teremki.kiev.ua)
Date: February 22, 2019 02:26PM

Hi!

My config is:
Win7 x64 (SP1)
WampServer Version 3.1.7 64bit
Apache 2.4.37
PHP 7.12.14
MySQL 5.7.24
WampServer icon is green (and start/stop/restart services works fine)

I want to create access to virtual host from internet.

What I've done:
1. Create rules for ports 80 and 443 forwarding on my router. It works.
2. Create Windows Firewall inbound rule for ports 80 and 443. It works too.
3. Change Require local to Require all granted in httpd-vhosts.conf in localhost section, Restart All Services and get access to localhost from internet. All it works.
4. Create Virtual Host with name WampShared via Add a Virtual Host from Tools menu.
5. In WampShared virtual host directory I create index.php file with simple echo command. It works on [wampshared] address.
6. Change Require local to Require all granted in httpd-vhosts.conf in WampShared section and change back Require all granted to Require local in localhost section. Restart All Services.

Now I see "Forbidden You don't have permission to access / on this server" message.

7. Disable Antivirus, just in case. Nothing changed.

My httpd-vhosts.conf is:
# 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
</Directory>
</VirtualHost>


#
<VirtualHost *:80>
ServerName WampShared
DocumentRoot "e:/wamp_shared"
<Directory "e:/wamp_shared/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>


Lines in C:\Windows\System32\drivers\etc\hosts:
127.0.0.1 localhost
::1 localhost

127.0.0.1 WampShared
::1 WampShared

What could be wrong? Why localhost works, but WampShared don't?

Thanks.

Options: ReplyQuote
Re: Access to virtual host from internet
Posted by: RiggsFolly (Moderator)
Date: February 22, 2019 05:01PM

You could try

ServerName wampshared

and

127.0.0.1 wampshared
::1 wampshared

as a first attempt

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.7 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <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: Access to virtual host from internet
Posted by: einfall (---.teremki.kiev.ua)
Date: February 22, 2019 05:57PM

Doesn't work. I tried several options, another virtual hosts etc. Only localhost works.

Options: ReplyQuote
Re: Access to virtual host from internet
Posted by: einfall (---.teremki.kiev.ua)
Date: February 22, 2019 08:58PM

Solved.
The solution is reordering VirtualHost sections. ) I thought the only Require all granted/Require local directives is important... RTFM, RTFM. )

Options: ReplyQuote
Re: Access to virtual host from internet
Posted by: RiggsFolly (Moderator)
Date: February 23, 2019 01:17PM

Hi

The order should not matter.

However Apache will fall back to the first VH defined if it cannot find the domain used in the browsers address bar.

To access the domain `wampshared` you should be using `http ://wampshared` is that the url you were using?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.7 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <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: Access to virtual host from internet
Posted by: einfall (---.teremki.kiev.ua)
Date: February 23, 2019 08:29PM

Hi!

I needed access form internet to my virtual host (not from local net, where I could edit hosts files etc.). As far as I know, I can use only my (static) IP-address in this case. This is from httpd.apache.org: "...only the order of the VirtualHost directives for one address set is important..." Probably everything is correct. )

Thanks.



Edited 1 time(s). Last edit at 02/23/2019 08:30PM by einfall.

Options: ReplyQuote
Re: Access to virtual host from internet
Posted by: RiggsFolly (Moderator)
Date: February 24, 2019 12:40PM

Hi

[forum.wampserver.com]

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.7 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <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


Sorry, only registered users may post in this forum.