Is there any way that I can block WampServer home page to be accessible from a remote machine (over a LAN) but still I want folders to be accessible.
Eg : I want : http://192.168.127.98 to be blocked
and http://192.168.127.98/website/ to be accessible
Thanks Quentin, you saved my day. I edited httpd.conf
<Directory "c:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
</Directory>
<Directory "c:/wamp/www/website">
Allow from all
</Directory>
and it works like a charm
Related
I use wamp. My PC is in a Lan. everybody in the Lan can see my localhost and I don't want that.
I want to limit people on Lan to just be able to see localhost/site/ but now everybody can see localhost and every files and folder that are in localhost.
How can I solve this?
I edit httpd.conf and change "deny from all" to "deny from none"
Knowing the IP address is the main goal here, of course you can deny from specific folder by opening .htaccess file:
<Directory specific_folder/>
Options FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.0(Replace this IP to allow access)
</Directory>
Let me know if this works for you
Localhost is actually your loopback address which resolves to 127.0.0.1 and this is only accessible from your PC. I think what your trying to ask is to allow IP's from your subnet to access certain directories but not others. If thats the case then to do this you will need to edit your httpd.conf and find the <Directory> section. The below example shows you how to enabled access from any PC with an IP from 192.168.1.0/24 (1-254) and localhost (127.0.0.1) to the following path /var/www/sub/folder/ then deny all.
<Directory /var/www/sub/folder/>
Order allow,deny
Allow from 192.168.1.0/24
Allow from 127
</Directory>
As you can see it firstly allows all from the the config and then deny's everything else. If you wanted access for just your local PC then you would do something like this:
<Directory /var/www/sub/folder/>
Order allow,deny
Allow from 127
</Directory>
This will only allow 127.0.0.1 (Localhost) to access the folder.
You can add multiple Directory settings within the httpd.conf for specific folders, just make sure you restart Apache for the changes to apply.
I'm not sure what your problem is, but localhost is only available from your own computer. (localhost resolves 127.0.0.1)
In order to display the webpages to other users on your LAN network you can use your LAN IP or a service like xip.io
After modifying the both the file (httpd-xamp.conf & httpd-vhosts.conf ) I can't access my website either in my localhost nor other computer.
typing in the browser address bar:
mydomain.local
But it only works in localhost computer when we when we type "localhost/phpmyadmin/"
when I'd like to allow another computer in the same LAN to access the website. I've configured the other computer hosts file to contain line:
192.168.1.180 mydomain.local
where 192.168.1.180 is the XAMPP computer IP address. But after typing the http://mydomain.local on the other computer browser, after pressing enter, the address becomes: http://mydomain.local/dashboard and message appear "Object not found & error 404".
So far, I have done this:
Changed c:\xampp\apache\conf\extra\httpd-xamp.conf file to contain this
Order deny,allow
Deny from all
Allow from ::1 127.0.0.0/8 192.168.1.180
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
On my XAMPP computer, I have the following configuration in c:\xampp\apache\conf\extra\httpd-vhosts.conf:
NameVirtualHost *:80
ServerAdmin postmaster#dummy-host2.localhost
DocumentRoot "C:/xampp/htdocs/myphpapp"
ServerName mydomain.local
ServerAlias mydomain.local
ErrorLog "logs/mydomain.local-error.log"
CustomLog "logs/mydomain.local-access.log" combined
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Is the redirection proper to your script or are you just redirect to your router administration panel?
By the way, if you want to do everything with ease, just take a look at Ngrok, one little line in CLI will solve your problem and it will also make it available outside of your local network!
I have installed WAMP on my windows 8 machine. When i browse to localhost in my browser, the WAMP server page is visible.
But when I browse to my IP in my browser, I get the message
403 Forbidden: You don't have permission to access / on this server.
i downloaded wamp server from this page
http://sourceforge.net/projects/wampserver/
and in C:\wamp\alias phpmyadmin file
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin3.5.1/"
# to give access to phpmyadmin from outside
# replace the lines
#
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#
# by
#
# Order Allow,Deny
# Allow from all
#
<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
Any suggestions?
Sounds like you need to make the same changes you made in the phpmyadmin config file to the Apache config file httpd.conf, by default Apache only allows localhost access. Search for httpd.conf and make changes ,I don't know where conf file would be placed by default on Windows box.
You could change :
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
into:
Options Indexes FollowSymLinks ExecCGI
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
That's in my file. Maybe this will help you. You also didn't say if http://localhost or http://127.0.0.1 works fine
But in fact it should work just right after install. If it's not maybe you should try to uninstall wamp and install again.
However if I were you I would consider using another wamp server. I've also used this one but updates are not very often, there are problem with switching php version if you need to do more testing. I recently have moved to http://www.easyphp.org/ and it works very nice, I can switch between php versions without problems and new versions (php/phpmyadmin) appear almost just after release date so I recommend you to test this one.
I'm using wamp on localhost at c:\wamp\www\.
The project located under: c:\wamp\www\MyProj\public (root).
In file1.php (located in root) I have a link to some fake url (/services/.....).
I'm trying to redirect that url to other file service_router.php (in the same direction as file1.php).
I'm doing that in httpd.config:
<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot c:\wamp\www\
<Directory "c:\wamp\www\">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/MyProj/public/services/*
RewriteRule . /MyProj/public/service_router.php
</VirtualHost>
But my WAMP refuses to restart.
What's wrong with my configurations?
Can I make a few suggestions.
If you want to use Virtual Hosts, and I consider that a very good idea. You need first to make sure that localhost still works and secondly it is a good idea to move you actual projects out of the \wamp\ folder structure.
So this would be a good starting point for your first ( of many ) VHOSTS
First create a new folder structure somewhere on any of your drives for example
C:\websites\project1\www
Now copy your project to the www folder.
Now setup the vhosts
# must be first VHOST so the that localhost and the wamp menu page still work
# Also makes this the default site so any randon hacks on your ip address
# will come here and hopefully be rejected because it only 'Allows' access
# from this machine ( see Allow Deny )
<VirtualHost *:80>
DocumentRoot "D:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/websites/project1/www"
ServerName project1.dev
ServerAlias www.dqsc.old
Options Indexes FollowSymLinks Includes ExecCGI
<Directory "C:/websites/project1/www">
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Unless you actually want to make this site available to the World can I suggest that you dont use Allow from all.
Try using or the second Allow line if you want to see your site from any machine on your internal network, just use the first 3 of the 4 quartiles of your ip address and it will allow access from any ip starting with those 3 quartiles.
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.0
Now you need to amend your HOSTS file so that windows knows about your new domain name.
Edit c:\windows\system32\drivers\etc\hosts and add the new site name project1.dev like so, you will have to launch your editor 'Run as Administrator' as this file is protected by windows :-
127.0.0.1 project1.dev
Now restart the "DNS Client" service to refresh the windows dns cache so it see's your new domain name. Start a command window, again "Run as Administrator".
net stop "DNS Client"
net start "DNS Client"
You should now be able to enter http://project1.dev in a browser and it will find you new site.
Finally, once you test that your site is working, put the url rewrite coding in a .htaccess file in the root of your new project.
C:\websites\www\project1\.htaccess
I am using WAMP, i have a magento project along with other php projects. All except magento project are accessible over LAN. In my office the IP that is alloted is a dynamic one, and changes upon reconnection. The problem is, upon fixing the IP in configuration--> web --> url,
the project runs, but soon after reconnection the magento project is not accessible on localhost nor on LAN (due to IP change). I am looking for a solution, that will make magento listen to current system IP when its online and also to localhost when its offline.
You should change your HOSTS file like this
127.0.0.1 anydomain.com
then change the record in the table [core_config_data] where the column [path = web/unsecure/base_url and web/secure/base_url] to http://anydomain.com
Go to admin page and flush magento cache.
Hope this work for your case.
First do this
https://www.howtogeek.com/howto/windows-vista/allow-pings-icmp-echo-request-through-your-windows-vista-firewall/
Then Add this to C:\wamp64\bin\apache\apache2.4.27\conf\extra\httpd-vhosts
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>