Access xampp from one computer to another computer via internet ip address - php

I was trying to access my xampp from another computer ,it is showing as forbidden error.Then i googled for answer for that they were telling some settings to change in httpd.conf file which is there in apache folder as follows:
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
#Order Deny,Allow
#Deny from all
#Allow from 127.0.0.1
#Allow from ::1
But it is not working it still shows the same error.can somebody help me to solve this.
And i want access my xampp from multiple computers as well can you please provide a solution for this .
Thanks.

try add new line
Allow from {other computer ip}
or for all
Order Deny,Allow
Allow from all
After change, restart xamp

If you have domain available try assigning domain to your server IP
Worked for me at last

Related

How to deny others to see localhost

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

wordpress domain name not working on lan + wamp server

i setup my wordpress site on my computer by using wamp server and every thing is ok ,
i can access my site via lan or wan by using the ip address like :
192.168.1.11/site
my host file like this :
127.0.0.1 demo.it
127.0.0.1 www.demo.it
192.168.1.11 demo.it
my vhost file like this
<VirtualHost *:80>
ServerName demo.it
DocumentRoot "c:/wamp/www/point"
<Directory "c:/wamp/www/point">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
i can browse the site on my computer by using the domain (demo.it) , but it's not working from other machine
help please
sorry for my english :)
You will have to enter the IP address of your local machine and the domain name as you have in your hosts file into any machine that wants to access your local wamp server.
192.168.1.11 demo.it
Of course, first the other machines must be able to reach 192.168.1.11, but as you said, they can access your site from http://192.168.1.11/site so that must mean they can reach you.
Just check via ping to be double sure. Open Command prompt and check output of
ping 192.168.1.11
If you can, there might be a way to configure your router or switch such that specific domain requests are routed to your IP address, but I don't know how to do it.

Block WampServer homepage from remote machine

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

Wamp Server : Access from different server possible to phpmyadmin, but not to the sites

I have Wamp Server installed on a Windows Server 2008. It's working fine on local, and here is my phpmyadmin.conf :
<Directory "c:/wamp/apps/phpmyadmin4.0.4/">
Options Indexes FollowSymLinks ExecCGI
AllowOverride all
Order Allow,Deny
Allow from all
Allow from ::1
</Directory>
The problem, is that I can access to phpmyadmin from my computer with servername/phpmyadmin, but I can't access to my websites nor the index page with servername/ or servername/site.
The port is 80.
I have this error :
Forbidden
You don't have permission to access /glpi on this server.
If you wish to allow access to your site in \wamp\www\glpi then the best solution is to create a Virtual Host but if you just want a quick solution all you need to do is use the wampmanager menu as follows :-
wampmanager -> Put Online
This will make the correct change, which is to change the httpd.conf file.
Here is a link to another answer on how and why to create Virtual Hosts, it is aimed at WAMPServer 2.5 but it will work just as well for WAMPServer 2.4 Project Links do not work on Wamp Server
For those who this was not obvious, the error came from the first line :
<Directory "c:/wamp/apps/phpmyadmin4.0.4/">
This only give access to the phpmyadmin directory. So the solution is to replace or add a new block with :
<Directory "c:/wamp/www/">
And now you'll gain the access to your websites from another computer.

Are there cmd prompts to quickly change httpd.conf DocumentRoot directories

I have multiple websites in folders that I need to switch back and forth too constantly. Each time I have to go to the httpd.conf file to find them and change DocumentRoot and Directory lines. I was wondering if there is a faster way to do this, maybe with a cmd prompt? Or maybe a php inc file I can create.
Thanks.
You would be much better off setting all your sites up as Virtual Hosts. They are always available and you dont have to change anything other than the url to access each individually.
HowTo: Create Virtual Hosts in WAMP
BEFORE DOING ANY OF THIS PLEASE ENSURE APACHE AND MYSQL ARE WORKING PROPERLY FIRST!!!
Create a new folder outside the wamp directory structure. For example
C:\websites\www
but this can be on any disk drive visible to the PC running wamp
Create a subfolder in c:\websites for each site you want to create. for example:
C:\websites\www\site1
C:\websites\www\site2
Edit the file C:\wamp\bin\apache\apachex.y.z\conf\extra\httpd-vhosts.conf where x,y and z are the version numbers of apache that you actually have installed.
NOTE: If you are switching between 2 or more versions of apache this will have to be done to all your versions of apache in turn.
SUGGESTION: I like to use the format sitename.dev to make it obvious to me that I am dealing with my localhost development copy of a site, you may prefer another notation, thats ok, the word dev has no actual defined meaning in this case, its just my way of naming my development versions of a live site.
NOTE: Remove or better still comment out ( using the # in column 1 ) the lines that already exists in this file. They are just examples.
example contents:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
## must be first so the the wamp menu page loads when you use just localhost as the domain name
## Also NEVER change the security to anything other than Allow from 127.0.0.1 localhost ::1
## Then a drive by Ip address hack should return a 403 denied access
<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias localhost
**Using Apache 2.2 syntax**
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
## For every ip in the subnet, just use the first 3 numbers of the subnet
## Check you actual subnet for the actual values to use here
Allow from 192.168.0
</Directory>
**Using Apache 2.4 syntax**
<Directory "C:/wamp/www">
Require local
## And possibly allow access from you local network
## Check you subnet for the actual values to use here
Require ip 192.168.0
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/websites/www/site1"
ServerName site1.dev
ServerAlias www.site1.dev
Options Indexes FollowSymLinks
**Using Apache 2.2 syntax**
<Directory "C:/websites/www/site1">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
#If you want to allow access from your internal network
# For specific ip addresses add one line per ip address
#Allow from 192.168.0.nnn
# For every ip in the subnet, just use the first 3 numbers of the subnet
#Allow from 192.168.0
# If you want to allow access to everyone
#Allow from all
</Directory>
**Using Apache 2.4 syntax**
<Directory "C:/websites/www/site1">
AllowOverride All
Require local
#If you want to allow access from your internal network
# For specific ip addresses add one line per ip address
#Require ip 192.168.0.nnn
# For every ip in the subnet, just use the first 3 numbers of the subnet
#Require ip 192.168.0
# If you want to allow access to everyone
#Require all granted
</Directory>
</VirtualHost>
Add as many as you require so each of your sites have one, changing the DocumentRoot, ServerName and any other of the parameters as appropriate.
This also allows you to make SITE SPECIFIC changes to the configuration.
NOTE: This will make the wamp manager "Put Online" function no longer have any effect on these new vhost'ed sites as the security for each one is now part of the vhost definition, so leave WAMP, OFFLINE.
If you want to put one or more sites online you will have to change the Allow commands MANUALLY in the httpd-vhosts.conf file.
To check your subnet do the following:
Launch a command window, and run
>ipconfig
Look for the line "Default Gateway" in the output and use the third number in your Allow commands.
Edit your httpd.conf file and search for these lines, they are near the bottom of the file.
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
Remove the '#' comment character on this line to Include your newly changed vhosts, this will cause apache to register their existance. eg
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
While still editing your httpd.conf file search for
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
DO NOT CHANGE THESE LINES!
Add the following after the <\Directory> tag to secure your new C:\websites folder.
<Directory "C:/websites/">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
This is to set security on your new directory structure so that access to these new sites is only allowed from 127.0.0.1 (localhost) unless amended from within a specific VHOST.
P.S. Your internal network will probably be something like 192.168.x.y, check your system first!
Now in order for your browser to know how to get to these new domain names i.e. site1.dev and site2.dev, we need to tell windows what IP address they are located on. There is a file called HOSTS that is a hangover from the days before Domain Name Servers (DNS) were invented. It is a way of giving nice easy rememberable names to IP address's, which of course is what DNS Servers do for us all now.
Edit your HOSTS file, this can be found in C:\windows\system32\drivers\etc , the file does not have an extension.
Windows protects this file so you must be an Administrator to be allowed to save changes to this file.
If you are using VISTA or Windows7/8 you may think you are an Administrator BUT YOU ARE NOT!!!!
So to edit this file you must launch your editor, or Notepad in a specific way to gain Administrator rights. To do this find your editors icon and launch it using the following key strokes:
Shift + Right Click over its icon, this will display a menu, click the item "Run as Administrator", and click "Allow" on the challenge dialog that will appear.
Now you are ready to edit the hosts file so navigate your editor to c:\windows\system32\drivers\etc\hosts
Add the following lines to this file
127.0.0.1 site1.dev
127.0.0.1 site2.dev
NOTE: You will need to add one line in this file for each of your new virtual hosts.
Once you have saved these changes you need to make windows refresh its 'domain name - ipaddress cross reference' cache.
To do this launch a command window as an Administrator ( Shift + Left Click over the command window icon ) and run these 2 commands.
>net stop "DNS Client"
>net start "DNS Client"
Note: The quotes are required as there is a space in the services name.
In order for Apache to pick up these changes you must bounce ( restart ) apache.
DO this by: Wamp manager -> Apache -> Service -> Restart Service
You should now be able to use the address site1.dev in your browser to get to your new sites.
Copy your sites code into the "C:/websites/xxxx" folder if you already have a site coded or,
place a quick and simple index.php file into the "c:\websites\xxxx" folder to proove it all works.
example:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>SITE1</title>
</head>
<body>
<?php
echo '<div style="background-color:red;color;white;text-align:center;font-size:18px">HELLO FROM Site1</div>';
?>
</body>
</html>
TROUBLE SHOOTING:
If you have used the new domain name ( site1.dev ) and it has not found the site.
a. Check the changes to the hosts file.
b. Restart the "DNS Service" that runs in windows. This caches all doman names that you use in a browser so that the browser does not have to query a DNS Server each time you re-use a domain name. This may have cached your failed attempt but a restart is easy and should solve the problem and is quicker that re-booting windows, which should also work.

Categories