Linking VirtualHost to a Real Domain (Windows Server 2019)
Posted by: fenrir (---.skm.com.ua)
Date: October 06, 2023 12:29PM

Good afternoon, please advise how to correctly link VirtualHost to a real domain name so that the project can be accessed from the internet. When debugging locally everything works, but I need it to work from outside.

Settings httpd-vhosts.conf:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:/wamp64/www"
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName asu.sfnuvs.sumy.ua
ServerAlias www.asu.sfnuvs.sumy.ua
DocumentRoot "c:/mkr/frontend/web"
<Directory "c:/mkr/frontend/web/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

On the local machine, everything works when making changes to the Hosts file, but there is no access from the Internet. If I understand correctly, the Hosts file is not needed when binding to a real domain. But when I remove an entry from this file, Wamp says that this host is not defined



Edited 1 time(s). Last edit at 10/06/2023 01:51PM by Otomatic.

Options: ReplyQuote
Re: Linking VirtualHost to a Real Domain (Windows Server 2019)
Posted by: Otomatic (Moderator)
Date: October 06, 2023 02:00PM

Hi,

There's no point in putting the contents of your httpd.conf file.

Take a look at what the Require directive is used for in a VirtualHost:
Require <- This is a link

and redirect port 80 into the "box" that lets you connect to the Internet.

Don't modify the hosts file, but rather find out what a DNS (Domain Name Server) is.

Your question has already been answered dozens of times here.

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

Options: ReplyQuote
Re: Linking VirtualHost to a Real Domain (Windows Server 2019)
Posted by: fenrir (---.skm.com.ua)
Date: October 09, 2023 10:32AM

Hi again, I changed the settings and it came out that you can only connect from outside the local network, i.e. for example from a mobile network and only if the domain is defined in Hosts otherwise it stops working anywhere. But I need it to work inside. What could be wrong?

The httpd-vhosts.conf settings now look like this:
<VirtualHost *:80>
	ServerName asu.sfnuvs.sumy.ua
	ServerAlias www.asu.sfnuvs.sumy.ua
	DocumentRoot "c:/mkr/frontend/web"
	<Directory  "c:/mkr/frontend/web/">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Order allow,deny
		Allow from all
		Require all granted
	</Directory>
</VirtualHost>

Options: ReplyQuote
Re: Linking VirtualHost to a Real Domain (Windows Server 2019)
Posted by: Otomatic (Moderator)
Date: October 09, 2023 10:53AM

Hi,

> Order allow,deny
> Allow from all
This is the old syntax for Apache 2.2! Not to be used with Apache 2.4. The link I gave you earlier (Require <- This is a link) is all about Require!

One more time -> find out what a DNS (Domain Name Server) is.

For this to work on the local network, you need to specify the IP of the local server, e.g. :
'http://192.168.0.11/asu.sfnuvs.sumy.ua/'

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

Options: ReplyQuote


Sorry, only registered users may post in this forum.