Good day, I have Windows Server 2012 R2, I installed WAMP Server 3, on wamp settings I enabled the following
- Virtual host sub-menu
- Menu item: Online/Offline
when installing wamp a "my-site" folder was created, i created a index.html file in there with a
then i created a vhost using the GUI (localhost)
and the httpd-vhosts.conf looks like this
ServerName my-site.dev
DocumentRoot c:/wamp64/www/my-site
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
after this, i clicked on Put Online and disabled my windows firewall
from a different computer on the network i am trying to access to (http://29.8.14.2/my-site.dev) (IP of the windows server / folder) but i get the message
"Forbidden
You don't have permission to access /my-site.dev on this server.
Apache/2.4.17 (Win64) PHP/5.6.16 Server at 29.8.14.2 Port 80"
could you please let me know what I am doing incorrectly?
thank you.
I know I answered this over on the WAMPServer forum but I thought it may be relevant to have an answer here as well.
First you cannot use publically addressable IP Addresses for a local network. So your 29.8.14.xx address range is probably causing some or all or these problems.
There are 3 address ranges provided for Private ip address ranges for Small, Medium and Large Internal networks and they are
RFC1918 name IP address range number of addresses
24-bit block 10.0.0.0 - 10.255.255.255 16,777,216
20-bit block 172.16.0.0 - 172.31.255.255 1,048,576
16-bit block 192.168.0.0 - 192.168.255.255 65,536
Pick one that suites your clients network size, current and potential.
Your next problem will be how to get all the PC's in this network to know where mysite.dev is in the network. If its only a few PC's then you can edit the HOSTS file on each PC and add an entry like this to each, I am assuming you go for the 16-bit block address range.
192.168.1.2 mysite.dev
just like you did to the PC running WAMPServer, but pointing the domain name to the IP Address of the PC running WAMPServer and your site.
Alternatively, if your client has a local DNS Server and MANY PC's, then it would be much easier to add your site to his DNS Server and then every PC should know where to find mysite.dev
Related
Installed WAMPServer
Version : 3.0.4
OS type : 64 bit
Apache : 2.4.18
PHP : 5.6.19 / 7.0.4 (5.6.19 checked)
MySQL : 5.7.11
I've tried to look at the older overflow questions and answers and tried to do along as they said, however, I still do not have any connection to the wampserver.
What I've done to test
Use localhost on the host laptop to check if wampserver is operational
[SUCCESS]
Use my IP on host to check if wampserver is operational [SUCCESS]
Use my IP on other devices on the network in attempt to access a php file of the server in a directory. [FAILED]
Use other devices to on the network to ping my host [Request timed out x4]
Use tracert command as an alternative to 4 [Request timed out]
What I've done to the server
Modification to httpd.conf
Listen 12.34.56.78:80//commented
Listen 0.0.0.0:80
Listen [::0]:80
Dynamic Shared Object (DSO) Support//commented
miscellaneous for LOAD MODULE
ServerName localhost:80
Deny access to the entirety of your server's filesystem. You must
explicitly permit access to web content directories in other
blocks below.
Directory//This directory tag has no reference to server
AllowOverride All
Require all granted
Directory
DocumentRoot "E:/Server/wamp64/www"
Directory "E:/Server/wamp64/www/"
Options Indexes FollowSymLinks
AllowOverride All
# onlineoffline tag - don't remove
Require all granted
Directory
What I've done to the host laptop
Fresh installation of WAMP
Backup original httpd.conf
Edited httpd.conf (Refer above)
[FAILED]Added rule for port 80 to enable all - Deleted
Disable all rules for inbound for port 80
Look for rules in outbound for port 80 [NONE]
All of the steps I've described does not work at all. Has no experience in firewall configuration and WAMP configuration. And no virtual hosts except localhost
P/S: The example link I tried testing was 1.1.1.1/testPHP/testPHP.php. The host is Win10 while the device on the similar network tested was XP. Any advice is greatly appreciated.
The apache configuration seems correct.
Check this if you're using Wifi on server or client
Check if the router/AP has enabled something called Wifi Isolation, or Client Isolation.
I looked on a similar router like yours and there it's one option called Client Isolation on the Wireless Basic setup of your router. Uncheck it, save and retry.
Check this on the Windows firewall
Press on your keyboard WindowsKey+R, write control.exe. Press enter
Double click on Windows Firewall
On the left vertical bar select Advanced Settings
Click Inbound Rules
On the right pane click New Rule...
Select Port and click Next button
On the top leave TCP option selected. And below select Specific local ports and write there 80 or the port your apache uses. Looking to your Listen line on the apache config you should write here 80. Press Next
Leave selected Allow the connection and press Next.
Select the profiles of the Firewall you want to use for this rule. If you doubt select all. Press Next
Set a name for the rule, and press Finish
Try it another time ;-)
Found the problem. Win 10 apparently had this setting I have had forgotten about - Make this PC discoverable (OFF)
I turned it off in the heydays of using Win 10 because of privacy concerns. Now it can be accessed. The next step is to figure out the forbidden access.
Edit
The culprit for this post is the Windows 10 OS Settings. In order for all the settings to work (Assuming the person has done all the tinkering with httpd.conf and firewall and/or router), the PC hosting the server must be checked whether is the PC discoverable in the network settings.
How to make sure it is discovered
Open Network Settings by left clicking the network icon on your taskbar (either lan or WiFi) then click Network Settings right above the bottom most icons.
Select Advanced Settings
Under the item Make this PC discoverable, there will be a switch button. Make sure the button is turned ON otherwise, left click on that particular button.
I am working on localhost right now. Suppose I have a route now at http://localhost:8000/info. Now I have a domain named www.helloyou.com.
In my project routing the routing for this info.php class is like /info.
How can I change http://localhost:8000/info to http://admin.helloyou.com/info. I am working on a Symfony environment.
In your Windows HOSTS file you can set a mapping from your domain to your localhost (127.0.0.1):
127.0.0.1 example.com
Located in C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS (On most other systems (Linux/OSX) it's under /etc/hosts)
Any requests for example.com will then go to your localhost - this is suitable for testing just on your local machine.
If you want to be able to test this from any machine on your LAN (including phones, tablets, etc.) then you can set an A record in the DNS Zone for that domain (perhaps for a localtest. subdomain) that points to the internal IP address of your server. eg. 192.168.1.20.
You need to go to your online management panel.
There you'll find something like DNS.
You add an A record from admin.helloyou.com to your public ip address.
Wait till all the caching servers are updated (can take 48 hours).
After this, your public device is visible trough admin.helloyou.com.
Now you need to go to your router (mostly 192.168.0.1).
Go to the page where you can set up NAT/PAT port forwarding (virtual server is a common name for this).
There you need to forward port 80 (public) to port 8000 (private) to your private address.
On your PC you need to allow public access to port 8000 in your firewall.
In the case that you don't have a NAT-router, but are directly connected, you cannot do this second step.
In that case you will always need to surf to port 8000, or let apache listen on port 80.
How can i access my local wamp server on another computer
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
i use this code in http.config file but not work
You could simply use the Put Online option of your WAMP Server and you can use this current system IP address and to directly access from the other computer.
Do this on system tray
Then, you could find your IP address using typing ipconfig or whatismyip.com website and then access it on another system.
As you are able to access it from the local computer that run the server by http://localhost you have two options to access it from your local area network LAN:
Using the local IP of the computer for example: http://192.168.1.20
Using the computer name for example: http://computer1/
To know your current IP:
Start -> in search field write cmd and hit enter to open the command line -> in the command line write: ipconfig you will get something like that:
Your computer IP address is the value of IPv4 Address.
To know your computer name just right click on the computer icon in the start menu then choose properties to get this screen shot:
However, for computer name method you have to be sure that every computer in your LAN has a unique name.
Update
There are some routers firmware supports local DNS on the router, so you have not need to edit the hosts files for every machine in the network. For example that I already have, dd-wrt firmware on Linksys WRT54G:
Mine wasn't working before when I tried using my computer's IP in the URL.
I found the reason to be the line in httpd.conf:
ServerName localhost:80
which I updated to be
ServerName {My comp's IP}:80
Step 1 : Press window button + R at the same time which opens the run tool of Windows.
Step 2 : Write CMD, then press 'Enter' button. This operation opens CMD terminal.
Step 3 : Then write 'ipconfig' command
Step 4 : Then note your ipv4 Address : 192.168.x.x (From Wireless Lan Adapter Wi-Fi Header) (This Ip address is needed by other computers in the place of localhost in URL)
Step 5 : Go to phpmyadmin.conf file of hosting system(Where wamp is installed...File path -> C:\wamp\alias\phpmyadmin.conf)
Step 6 : Replace this statement
<ifDefine APACHE24>
Require local
</ifDefine>
<ifDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
</ifDefine>
with
Require local
Require ip 192.168.0
Note : (If your Ip is something like 192.147.x.x) then you write 'Require 192.147.0' instead of 'require 192.168.0')
Step 7 : Restart your Wamp server
Step 8 : Enter the link 192.x.x.x/phpmyadmin in the url bar of your own system from which you want to access the hosting wamp server
Step 9 : End.
If you just need to access the wamp server from another LAN PC, as some of the answers have pointed out, you can use the LAN IP or Computer-Name in the URL, as long as VirtualHost's ServerName or ServerAlias directive contains that LAN IP or Computer-Name (so Apache can return the correct website).
But if you need to use a domain-name, you'll have to edit every PC's Hosts file and update it with the correct domain-name to LAN IP address resolve (and make sure that LAN IP is assigned each time to the correct device by the Router).
Though there are much better solutions that will work for all devices (including Mac, Linux, mobile devices such as iPhones, Android phones, etc) if you have a WiFi Router that can either be flashed with one of the open firmwares or is already capable of DNS Masquerading as outlined here: Accessing Websites on a Local Network (LAN) Web Server. "DNS Masquerading" (in this context) is basically using the WiFi Router's own "Hosts file" to do the domain-name to LAN IP resolve.
Hope this helps
I couldn't connect event after doing all the above-mentioned steps. Then I uninstalled my current wampserver (3.0 version) and installed 2.5 version of wampserver. And it worked perfectly. You just need to click on 'Put Online' and you are done. Others can access your server by putting your ip address in the URL instead of localhost.
stop the wamp server and open C:\wamp64\bin\apache\apache2.4.41\conf\extra\httpd-vhosts.conf
replace
# Virtual Hosts
#
<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>
add
Require all granted
above the Directory closing tag.
Then turn off the windows firewall for [domain, private,
public] networks in my case only [private network] works
Re-Start wamp server
Our Set-up
MVC app on a LAMP stack on AWS with:
Zend 1 front end app on a medium c1 AWS instance
MySQL database on a medium m1 AWS instance
running phpbb3 forum in parallel with MVC app on app server, with 2 x databases on the db server (one for app, one for phpbb)
php 5.4.22
mysql 5.1.72 + mysqli
elastic IP addresses associated to both the app and database servers
app & db servers are connected using private IP (ie app server connects to db server private ip, db server accepts the app server private iP on port 3306)
currently running the site as a dev site, using a dev directory off the main site eg:
www.mysite.com/dev/
in /dev/configs/application.ini we define the following:
setting.basedir = dev
setting.baseurl = http://www.mysite.com/dev
setting.securebaseurl = http://www.mysite.com/dev
have our DNS with godaddy, and are using A host = IP address (ie XX.XX.XX.XX) not cname
are not using virtual hosts (since we only have one site per 'server')
we have htaccess files & various redirects throughout - but have no errors on our local LAMP servers
we are using minify and have the RewriteBase commented out (per default)
httpd.conf settings are mostly default (let me know if there are important ones that aren't listed here)
ServerName "mysite.com"
UseCanonicalName Off
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
The Problem
We're getting the following intermittent error in /etc/httpd/logs/error_log :
File does not exist: /var/www/html/var, referer:
http://www.mysite.com/dev/various
When this error happens, a half complete page of whichever part of the site we were trying to access is displayed with the message:
"Failed saving metadata to metadata Cache"
Error is intermittent in that we can't repeat it with any sequence of actions or timing:
repeated page refresh seems to get rid of the issue, the page will eventually be displayed correctly and the rest of the site can be accessed normally for long periods
it is independent of browser or IP address (used to access the site)
it seems independent of the page we try to access (ie we've had errors from all site pages)
error seems to resurface after leaving the site idle for periods and then accessing a new part of the site - although this is inconsistent (sometimes the error reappears halfway through using the site actively).
We do not have this problem on local machines - we have about 3 different local machines on mac lamp stacks & windows machines with our developers.
We did not have the problem on the original AWS configuration which was app + database on a single linux ami micro instance - accessed via ec2 addres & configs/application.ini baseurl set to ec2 address (ie we were not using DNS A host settings at that stage)
Theories and things we've tried:
When we update the application.ini settings to use IP rather than DN we don't seem to get the error (which would indicate a server root / dns loop of some sort)
setting.basedir = dev
setting.baseurl = http://www.IP.IP.IP.IP.com/dev
setting.securebaseurl = http://www.IP.IP.IP.IP.com/dev
Initially we thought it could be that in httpd.conf ServerName was commented out, but when we set that to www.mysite.com it makes no difference
We have done the usual steps of deleting all Zend + forum + browser cache, restarting Apache, restarting MySQL etc
Nothing we do seems to indicate where the source of the error is.
It seems that I'll never get along with mod_rewrite...
I'm in the typical scenario:
homepage_one.tld/impressum.php --> domain.tld?content=impressum
homepage_one.tld/projects.php --> domain.tld?content=projects
homepage_one.tld/projects/canvas.php --> domain.tld?content=projects&project=canvas
I'm developing offline, using Ubuntu Server Edition on an VMware. That means, the local domain for my homepage_one to test is: _http:///localhost:2180/homepage_one/index.php
Later it will be _http://homepage_one.tld.
<Directory /var/www/homepage_one>
RewriteEngine on
RewriteRule ^([^/]*)\.php$ index.php?content=$1 [QSA,L]
RewriteRule ^projects/(.*)\.php$ index.php?content=projects&project=$1 [QSA,L]
</Directory>
All css / image links are *broken * now, when I'm asking for the url: _http://localhost:2180/homepage_one/projects/canvas.php
(It looks for "homepage_one/projects/canvas/style.css" instead of "homepage_one/style.css"
most answers at stackoverflow concerning this issue are: use absolute links. I tried it, but to test it offline, my absolute link would be /homepage_one/style.css and i would have to change ALL links, once I publish the website. I also tried to use the html-base tag. But this didn't work eigther.... any ideas?
Johannes this is really an answer to your answer :-) The conventional way to list entries is IP name name, e.g.
127.0.0.1 localhost mysite.vm subdomain.mysite.vm blog.mysite.vm
or whatever.
I also find port forwarding a total pain. I always use a bridged or host-only network. My Windows/WMware skills are a bit rusty as I gave up on both about 5 years ago, but this VMware page describes how to do it if you are using VMware Workstation. You can do the same with a VMware appliance but you have to start tweaking the VMX file. As I said in my blog article, which I recommend that you read, I find just easier with VBox.
In a bridged network, if you host NIC's MAC address is 00:23:18:dd:88:88 and your VM's is 08:00:27:FE:FE:FE then the VMware network driver programs the host NIC to respond to both but then passes the 08:00:27:FE:FE:FE packets onto the VM's virtual NIC. Hence the VM participates on the network just like any other PC and looks like a PC/server to any other devices. I run all my home devices on a 192.168.1.0/24 private address space, so I just statically allocate IPs for my VMs in 192.168.1.192/26.
The great advantage of bridged and host-only networks is that you can use the default port 80, and that if you want you can also (temporarily) override your DNS entry for your myprodsite.com to point to your VM, so that any absolute coded http://myprodsite.com/ URIs will then point back to the VM during testing.
Hope this helps :-)
Solution (thanks to #TerryE):
Edit C:\Windows\System32\drivers\etc resp. /etc/hosts (linux)
127.0.0.1 my_homepage1.vm
127.0.0.1 my_homepage2.vm
in my case, using port forwarding to different VM's, I can reach them, as followed:
my_homepage1.vm:2180 --> VM1
my_homepage1.vm:2280 --> VM2
now I can just use VirtualHosts, as on my production Server, and go with absolute links.