Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: August 30, 2022 01:46AM

Hi,

I have a dns created in windows: [xena.cox]

if I write the url [xena.cox]. he tells me forbidden, and that's fine with me


Later I create a virtual host for [xena.cox] and it works fine.


Now if I write the url [xena.cox]. he tells me forbidden. But what I want is for it to tell me not found.


How can I do to achieve it?

Thanks.

Options: ReplyQuote
Re: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: Otomatic (Moderator)
Date: August 30, 2022 08:31AM

Hi,

PhpMyAdmin must be launched by the links in Click-Left menu or in 'http://localhost/' page.

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.10 32 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.10 64 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39/8.0.30 - MariaDB 10.5.17/10.9.2
PhPMyadmin 5.2.0 - 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: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: August 30, 2022 08:32PM

Thanks for answering. I think I didn't make myself understood.

I give you the following example: xena.cox

#
<VirtualHost *:80>
ServerName xena.cox
DocumentRoot "c:/users/dex/documents/tutos"
<Directory "c:/users/dex/documents/tutos/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>


there is an alias created as phpmyadmin "Require local"

If I write this url in the browser: [xena.cox] gives me the following message: forbidden.
And that message is correct, since phpmyadmin is configured as: Require local.

But what I want is that for each virtual host that is created, I want to receive the following message: Not Found. example:

If I write this url in the browser: [xena.cox] I want to receive the following message: Not Found.


In the uwamp server for each virtual host that is created, and according to what was stated above, it will always give me the message not found, but in wampserver the message is forbidden.

Options: ReplyQuote
Re: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: Otomatic (Moderator)
Date: August 31, 2022 10:42AM

Hi,

> I want to receive the following message: Not Found.

It is Apache that handles the error messages. I don't know if you can change the type of message in Apache, but I'm afraid it's not possible. You have to check with the Apache documentation.

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.10 32 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.10 64 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39/8.0.30 - MariaDB 10.5.17/10.9.2
PhPMyadmin 5.2.0 - 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: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: RiggsFolly (Moderator)
Date: August 31, 2022 04:51PM

This is probably because the first thing Apache does is see if you are allowed to access something, then if you are it will look to see if the subfolder (alias) actually exists.

So you fail at the first hurdle and therefore get the message FORBIDDEN

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<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: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: August 31, 2022 09:11PM

Thanks Otomatic, and RiggsFolly for your answers.

Solution:

What happens is that wamp server does not handle the virtual hosts and aliases in the httpd.conf file.
wamp server handles virtual hosts in a separate file. and the aliases in a folder.

When hosts and aliases are handled in the httpd.conf file, each host is independent, and can only access what it has been given permission to.
as it is currently configured in wamp serer, there is a risk that any host can access unauthorized sites. example phpmyadmin from intranet and internet.

If I want only one host to be able to access phpmyadmin, with the current configuration of wamp server any host could access.
One solution would be to change the name of the phpadmin alias to something like /pmad8974.

other solution is to comment out these lines in the httpd.con file.

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf


#Include "${INSTALL_DIR}/alias/*.conf"


after commenting those lines, create the virtual host and aliases in the httpd.con file (at the end of the file).

Options: ReplyQuote
Re: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: RiggsFolly (Moderator)
Date: September 01, 2022 09:36AM

Please, nobody else should follow this nonsense even if you can understand it.

Maybe Oto should consider deleting it.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<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: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: Otomatic (Moderator)
Date: September 01, 2022 10:32AM

Hi,

No, I'm not going to delete this nonsense but rather provide a rational, Cartesian explanation.

Putting an include in the httpd.conf file is exactly the same as writing the instructions of the include file directly in the httpd.conf file.

On the other hand, in your 'http://mysite/phpmyadmin' url, it is quite normal not to have the 'not found' error since the phpmyadmin alias exists.

uwamp gives 'not found' because there is no phpmyadmin alias. Period

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.10 32 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.10 64 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39/8.0.30 - MariaDB 10.5.17/10.9.2
PhPMyadmin 5.2.0 - 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: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: September 01, 2022 03:33PM

I think maybe I didn't make myself understood with my question and solution.

I don't speak English, and I do the translations through google, so I don't know if the translation was really correct.

For me it is not nonsense, and fortunately I found the correct solution for what I wanted to do.

If you want to delete the post, do it, you are within your rights.

Maybe someone later with a situation similar to mine, will be able to understand this post, and it will be useful.

Options: ReplyQuote
Re: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: September 01, 2022 04:25PM

Otomatic Wrote:
-------------------------------------------------------

> Putting an include in the httpd.conf file is
> exactly the same as writing the instructions of
> the include file directly in the httpd.conf file.


totally agree. For what I want to do, with delete or comment the line: #Include "${INSTALL_DIR}/alias/*.conf" It is more than enough

However, if I decide to comment out the line: #Include conf/extra/httpd-vhosts.conf. From that moment on, the vhost.conf file found in the config/extra folder will no longer make any sense, since everything will be handled only in the httpd.conf file.


I'm sorry for not making myself understood. (No speak English)
Maybe later I can edit the post to try to leave it as it really should be, as long as they wish, since I think they will delete it.

my problem is already solved.
If you want you can delete the post.
If you wish, I could edit the post so that it is understood in the best possible way.
The decision is yours
Anyway, thank you very much.



Edited 1 time(s). Last edit at 09/01/2022 04:32PM by kent.

Options: ReplyQuote
Re: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: September 02, 2022 07:58PM

Otomatic Wrote:
-------------------------------------------------------

>
> uwamp gives 'not found' because there is no
> phpmyadmin alias. Period

I had not seen this response.

uwamp has no aliases folder, but aliases are handled directly in the httpd.conf file. And among those is phpmyadmin.

If in uwamp I write the url localhost/phpmyadmin I enter correctly to phpmyadmin.

But if in uwamp I write the url [xena.cox] it will show me the message "Not Found"

if in wamp server I write the url [xena.cox] it will show me the message "Forbbiden"

With the adjustment that I made, I manage to show me the message "Not found" as it is shown by uwamp.

Options: ReplyQuote
Re: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: Otomatic (Moderator)
Date: September 03, 2022 08:56AM

It would still be necessary to see how the aliases are defined!

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.10 32 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.10 64 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39/8.0.30 - MariaDB 10.5.17/10.9.2
PhPMyadmin 5.2.0 - 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: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: September 04, 2022 04:09AM

Otomatic Wrote:
-------------------------------------------------------
> It would still be necessary to see how the aliases are defined!

aliases are configured in the httpd-vhosts.conf file.

# Localhost


<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  Alias /adminer "c:/wamp/apps/adminer4.8.1/"
  Alias /phpmyadmin "c:/wamp/apps/phpmyadmin5.1.1/"
  Alias /phpmyadmin4.9.7 "c:/wamp/apps/phpmyadmin4.9.7/"
  Alias /phpsysinfo "c:/wamp/apps/phpsysinfo3.3.4/"
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
  <Directory "c:/wamp/apps/adminer4.8.1/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require local
  </Directory>
  <Directory "c:/wamp/apps/phpmyadmin5.1.1/">
    Options +Indexes +FollowSymLinks +MultiViews
    AllowOverride all
    Require local

# To import big file you can increase values
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
  </Directory>
  <Directory "c:/wamp/apps/phpmyadmin4.9.7/">
    Options +Indexes +FollowSymLinks +MultiViews
    AllowOverride all
    Require local

# To import big file you can increase values
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
  </Directory>
  <Directory "c:/wamp/apps/phpsysinfo3.3.4/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require local
  </Directory>
</VirtualHost>

# My Virtual Host

<VirtualHost *:80>
	ServerName xena.cox
	ServerAlias xena.cox
	Alias /adminer "c:/wamp/apps/adminer4.8.1/"
	DocumentRoot "c:/wamp/www/qt"
  <Directory  "c:/wamp/www/qt/">
	Options +Indexes +Includes +FollowSymLinks +MultiViews
	AllowOverride All
	Require all granted
   </Directory>
   <Directory "c:/wamp/apps/adminer4.8.1/">
     Options Indexes FollowSymLinks
     AllowOverride all
     Require all granted
  </Directory>
</VirtualHost>


#
<VirtualHost *:80>
	ServerName laner.cox
	ServerAlias laner.cox
	DocumentRoot "c:/wamp/www/tf"
  <Directory  "c:/wamp/www/tf/">
	Options +Indexes +Includes +FollowSymLinks +MultiViews
	AllowOverride All
	Require all granted
   </Directory>
</VirtualHost>

With this configuration only localhost and xena.cox will be able to access adminer(Alias). laner.cox will not be able to login to any alias, and trying to login to any alias will show the message "Not Found"

I've tried logging in locally, intranet, and internet, and everything works fine.

If I type localhost in the browser, I can see everything there, my virtual hosts, my aliases, general information, and if I click on the links, it takes me to the corresponding page.


However, at the top of the localhost page I get notices of:

Notice:Undefined Index ServerName in C:\wamp\scripts\wampserver.lib.php on line 797
Notice:Undefined Index DocumentRoot in C:\wamp\scripts\wampserver.lib.php on line 798
Notice:Undefined Index Port in C:\wamp\scripts\wampserver.lib.php on line 799
Notice:Undefined Index Port in C:\wamp\scripts\wampserver.lib.php on line 800

These 4 notices are given for each alias configured with their respective permissions. (For the code that I have attached above, 20 notices are obtained).

Any way to prevent these warnings from appearing from the uwamp console, or anywhere else?

If I included this line in the wampserver.lib.php file, the news disappears.
error_reporting(0);

Should I worry about those warnings?

Despite those warnings, everything works perfectly.

Options: ReplyQuote
Re: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: Otomatic (Moderator)
Date: September 04, 2022 09:38AM

> Should I worry about those warnings?

As long as you don't follow the rules, you can do whatever you want with them.

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.10 32 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.10 64 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39/8.0.30 - MariaDB 10.5.17/10.9.2
PhPMyadmin 5.2.0 - 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: Virtual host when accessing aliases receive message not found, instead of forbidden
Posted by: kent (---.cable.net.co)
Date: September 05, 2022 12:56AM

Everything works perfect. Thank you for your answers.

Options: ReplyQuote


Sorry, only registered users may post in this forum.