Website in lan with virtual host? - apache

I have a specefic problem, i have more websites on my localhost server (xammp), they has a virtul host, but i want to access this websites trough lan or wlan because so i can test it on mobile devices. If i call only ip on other device then i see xammp control panel, but i don't know how can i call websites in lan like: "site1.local, site2.local, site3.local", are here static ip's needed? On the router is DHCP enabled. I read few topics and this is all clear for me, the problem is only access on this sites trough network.
Read topics:
How to set up Apache virtual host such as http://home/, http://office/, etc
Accessing localhost (xampp) from another computer over LAN network - how to?
How to set up Apache virtual host such as http://home/, http://office/, etc
Apache: see named virtual hosts from LAN

Find your IP of your server machine. If it uses windows, press start then type into the search bar cmd. Then when a command promt comes up type in ipconfig and hit enter. Look for "IPv4-address" and to the right of that is your local IP of your computer.
Then you can use a computer on your wireless LAN or a wired connection. Simply type in the IP of your computers local IP with XAMP, and you are good to go!
Hope this helped
-Kad

I do this on work for testing. We have a XAMPP localhost server. My projects are in the htdocs folder. like this: c:\xampp\htdocs\niceproject
The IP for reqesting xampp is something like this: 192.168.10.104.
Now for calling the Websites just do this: 192.168.10.104/niceproject
I hope this is what you are looking for.

To access multiple sites (virtual hosts) served from one machine (say lanwww running apache) on mobile devices the usage of ServerName (say site1, ServerAlias site1.lanwww) fails - the DHCP on the router won't map subhosts (site1.lanwww). I found that using different ports for the subsites works nicely though - remember to add appropriate Listen statements to the ports.conf. The configuration of other webservers is left as an exercise to the reader.

Related

How to remotly access a custom wampserver's virtual host in a local network?

I use Wampserver 3.0.6 under windows 10 and I want to share my application between my personal PC (The host) and some other computers linked to the same home network (Clients).
I changed a line on httpd-vhosts.conf file to let the application be accessible from other machines in the network from this:
Require lacal
to this:
Require all granted
The problem is that the default virtual host (localhost) is accessible from those clients using the host's ip adress like this 192.168.###.###/ but not my customized virtualhost (tilelli on this case). Here is the content of httpd-vhosts.conf file now:
enter image description here
I tried to access it via 192.168.###.###/tilelli/ and directly via tilelli/ but didn't work.
Can anybody help me please ?
If you define a Virtual Host Servername as tilelli then Apache will serve that site when it sees that domain name in the connection request i.e. http://tilelli.
If you have a local (company) DNS Server, add that domain to it, pointing to your WAMPServers PC's IP Address. If you dont have a local DNS Server, then change the HOSTS file on the PC's that need to see this server so they know where to look for it
HOSTS FILE
192.168.xxx.yyy tilelli
You do have to change each and every one of the other PC unfortunately.

Accessing localhost (xampp) from another computer over LAN network without URL changing

I have already read Accessing localhost (xampp) from another computer over LAN network - how to?, but I couldn't find an answer to my question.
I have setup custom domain(virtual host like how to create virtual host on XAMPP). The local IP of this PC is 192.168.1.9 and I access to it using http://sample.test.
Now I am on another PC and it local IP addresses is 192.168.1.8. How to access http://sample.test via this PC? Is it possible to configure this pc to access to the site just using http://sample.test because URL changes(Starting URL with IP Address) break the site.
Update : I am on Windows 10 PC
As you are on a Windows 10 PC try editing your Windows hostfile, found at C:\Windows\System32\drivers\etc adding the line
192.168.1.9 sample.test
Edit host file in your client computer (Windows 10), it's located on
C:\Windows\System32\Drivers\etc.
Add the ip and virtual domain like this and then save the file, you might have to run your text editor as administrator.
======= My Web App =======
127.0.0.1 localhost
192.168.1.9 sample.test

cannot access my webpage from outside (xampp)

I am trying to set up a web server with Xampp (ver 7.0.13) on my home PC. I redirect port 80 from router to my PC and Xampp is listening to port 80. Also, I change router's web server's port to 8080 in order to avoid conflict.
Result: I can access my helloworld.html on my pc and my phone. However, If i turn off my iphone wi-fi and using 4G network, I will not able to access dashboard and my helloworld.html by public ip (56.XXX.XXX.XXX/helloworld.html)
I try :
reinstall xampp
try different version off xampp
change config file >> Order deny,allow from all (something like that
try to change but cannot be found in most of the config files.
change router port forward setting.
But nothing work. What did I do wrong? ┐(´д`)┌
Maybe external traffic is blocked by the Windows-Firewall?
Is it a static IP? You should use a static IP in your server, if not, is impossible

Unable To Connect To MAMP Server From Other Devices

I have MAMP PRO running locally on my machine (Mavericks). I can connect find to localhost and apache is running on port 80.
The test website I have set up is served. I can browse to it via http:// my-local-host (have to put a dash in because stack exchange doesn't like URLs) or http://mymachinename.local or http://XXX.XXX.X.XX (my ipaddress).
It's not working remotely though from either iPhone or iPad. I have tried turning off the firewall. I have tried adding a rule to the firewall to allow incoming connections to httpd. Neither work.
I also have Little Snitch installed. I tried turning off Little snitch and also creating a rule to allow traffic through to port 80 via httpd. Neither work.
Anyone else had similar issues and found a resolution?
The problem is DNS.
MAMP writes your Hosts to /etc/hosts.
Example:
127.0.0.1 example.com
Your Iphone's host file has no such entry. This is why it does not work.
You need e.g. a "DNS-server", which you can enter in
Settings - Wlan - static as Router on your phone.
I think your problem would be addressed if you use the Dynamic DNS option in MAMP PRO. Then, using a third party company like noIP.com, you could setup myTestBox.ddns.net and pull up your website on your iPad.

show my localhost in someother pc via ip

I have a site in my local which is running under xampp.Now in another Mac I want to access the local site.It can be done via sharing the ip? or something to write in host file.The source machine is windows and the target machine is mac.
I dont know how to include the ip in host file in Mac.
Assuming that it's running on port 80 or 443 and your firewall is set to allow requests on those ports, you should be able to navigate to the ip address in a browser. If you're requesting your local site from outside your subnet then you might need to configure port forwarding on your router