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.

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

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

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

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.