Block WAMPSERVER Homepage
Posted by: Thunderroy (152.207.200.---)
Date: June 08, 2018 06:59PM

Hi, thanks in advance.

Recently I installed WampServer 3.1.3x64 and Joomla 3.8.8 stable. All works fine, but, I need to block the wamp homepage, a mean, if any user type this: [servername] the browser shows all the projects and config of my webserver.

I need to block that, if any user try to enter this URL, show an error, or a blank page.

please, help me.

Thanks a lot.

Options: ReplyQuote
Re: Block WAMPSERVER Homepage
Posted by: Otomatic (Moderator)
Date: June 09, 2018 10:36AM

Hi,

You can use an access restriction system with user name and password that can be applied to VirtualHost folders, i.e. to the one on the Wampserver homepage (localhost)
To do this you create a text file ".htpasswd" located in "j:\wamp\www\.htpasswd" (Adpate the complete path according to your own installation).
In this file, you put pairs "username:passwords". It can only have one, but you can put several, of the form:
username1:password1
username2:password2
etc.
As with all configuration files (Apache, PHP, MySQL, etc.) the last line must always end with a line break, i.e. an empty line last.

Then you modify the VirtualHost localhost in the wamp\bin\apache2.4.33\conf\extra\httpd-vhosts.conf file by replacing the original one:
<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>
by
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
#    Require local
    AuthName "Restricted access"
    AuthType Basic
    AuthUserFile "${INSTALL_DIR}/www/.htpasswd"
    require valid-user
  </Directory>
</VirtualHost>
And each time a user, either voluntarily, by mistake, or by VirtualHost by default, will want to access localhost, a user name and password will be requested.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.4 32 bit - Apache 2.4.35 - PHP 7.2.11/7.1.23/7.0.32/5.6.38 - MySQL 5.7.23 - MariaDB 10.3.10
Wampserver 3.1.4 64 bit - Apache 2.4.35 - PHP 7.2.11/7.1.23/7.0.32/5.6.38 - MySQL 5.7.23 - MariaDB 10.3.10
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: Block WAMPSERVER Homepage
Posted by: Thunderroy (152.207.200.---)
Date: June 11, 2018 02:38PM

Hello, and thankyou so much.

I realle appreciate this Answer, just one thing. When user enter [localhost], the browser asks for user and password previously declared in .htpasswd file, but, when user enter to a real site, for example, [localhost] the browser asks for user an password too. The idea is great, but onle for localhost, not for sites that I want to enter without passwords.

Waiting for answers.

Thanks a lot again.

Options: ReplyQuote
Re: Block WAMPSERVER Homepage
Posted by: Otomatic (Moderator)
Date: June 11, 2018 03:55PM

Hi,

> when user enter to a real site, for example, 'http://localhost/myrealsite' the browser asks
> for user an password too.

You must, as with all hosting providers, use VirtualHost for ALL your local sites.
This way, your users will ask 'http://myrealsite/' instead of 'http://localhost/myrealsite/' and, as only VirtualHost "localhost" is password protected, there will be no more problems.

See The need for Virtual Host and Wampserver 3 - Create or add a VirtualHost

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.4 32 bit - Apache 2.4.35 - PHP 7.2.11/7.1.23/7.0.32/5.6.38 - MySQL 5.7.23 - MariaDB 10.3.10
Wampserver 3.1.4 64 bit - Apache 2.4.35 - PHP 7.2.11/7.1.23/7.0.32/5.6.38 - MySQL 5.7.23 - MariaDB 10.3.10
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: Block WAMPSERVER Homepage
Posted by: Thunderroy (200.55.166.---)
Date: June 11, 2018 10:02PM

Hi, and thanks again.

I read that using VirtualHost the IP must be fixed not assigned by DHCP. That's a problem cause the server where the site will be hosted use dynamic IP number.

Imagine, that I put the site in the final server (all the tests are in my PC, thats why I write localhost). Imagine, the site URL is [server]. Whe users enters there's no big deal, but if users type [server] can see all the projects because browser shows Wamp Homepage, that is what I wan to block, that homepage.

Thanks again.

Options: ReplyQuote


Sorry, only registered users may post in this forum.