Accessing localhost (xampp) from another computer - apache

First, I already searched stack overflow and followed the suggestions in previous answers, such as How do I connect to this localhost from another computer on the same network?
I have created a PHP/MySQL application for a client. The want to host it locally on that server.
The machine in question is running an application written in another langauge (I'm not sure which one) and running Tomcat on port 8080.
They also do not have separate staging/production environments, so this is not ideal.
Their other web application needs to remain running while I also port over the new app. I installed XAAMP onto their system and got the app running locally using Apache HTTP. However, they want other computers both within and outside their networks to be able to connect to the Windows server as well. They are already doing this for the previously created app that is running on Tomcat.
Ports 80 and 8080 are already being used, so the firewall was updated to allow my application to run on port 8086.
I used ipconfig to the find the local IPv, and then tried updating the http.conf and vhost file and am listening to the IP on port 8086. However, going to the IP/foldername doesn't resolve on another computer in the network. As a test, I also just typed in the IP of the windows machine, and it never resolves.
I generally don't implement of windows; until now, all of my production applications have run on some flavor of unix. Their other application is live and I don't want to disturb it. They access it by going to {servername}:8080. I tried server:8086 to see if my app could be accessed that way, but it can't.
I confirmed that localhost/foldername resolves.
Here are the exact steps that I have taken. I tried two different solutions.
Solution 1, using How do I connect to this localhost from another computer on the same network? as a guide:
Make sure firewall allows port 8086 access
I modified the C:\xampp\apache\conf\extra\httpd-vhosts.conf file to include a virtual host for the application:
DocumentRoot "C:/xampp/htdocs/{foldername}"
ServerName dispatchserver
Went to the Windows host file located at \Windows\system32\drivers\etc\hosts and added the following:
192.xxx.x.xx dispatchserver
From a computer outside the network, tried to go to the following URLs (non resolved):
http://192.xxx.x.xx
http://192.xxx.x.xx:8086/
http://192.xxx.x.xx/foldername
http://dispatchserver
http://dispatchserver/foldername
Since they didn't work, I tried a solution using this older stack overflow answer: Accessing localhost (xampp) from another computer over LAN network - how to?
Made sure firewall allows port 8086 access
XAMPP control panel > Config > Service and Port Settings > Apache > Changed main port to 8086.
XAMPP control panel > Apache > Config > http.conf
Searched for "Listen 80" and replaced with Listen 8086
Right above that, added Listen 192.xxx.x.xx:8086 (I used the IPv4, but don't want to include full address for security reasons). I added this line with hashtag at first (#192.xxx.x.xx:8086) and then without hastag after that didn't work (192.xxx.x.xx:8086).
Searched for and set this up as the directory statement:
AllowOverride All
Require all granted
Restart Apache
What steps can I take to allow the new webapplication I installed via XAMPP to be accessible to other computers?

In that case it's a little different if you want to web enable this. You need to set up your router to port forward to your server (app)so that the other network can reach it from the internet. Your router blocks incoming requests by default so a port forwarding rule using the port you mentioned will work. You should also put your server computer (the one with the app) on a static ip address to make things easier. Then for the user to see your app you need to give them the ip address of your internet connection (seen via sites like ipchicken.com) and the port number in the url.

Normally you just need to open the ports in the windows firewall on both computers (inbound and outbound) for the ports your application is using and then connect to the other machine via ip address and port number if they are on the same network.

Related

How to host WAMP servers on multiple PCs in same network and allow access through external link?

I have few PCs in same network. One of the machines (ip: 192.168.1.110) is already hosting a WAMP server which is accessible through an external IP. I now want to install WAMP server on one more machine (ip: 192.168.1.120) and make it accessible through external link. But this new machine is not getting accessed through external link. Is there any configuration related stuff that I need to do in httpd.conf file to make it happen?
There are a number of issues with your idea of using a second PC running a second WAMPServer. Not that 2 machines and 2 WAMPServers is a problem.
First, I assume your router has already had port 80 "Port Forwarded" to the original PC's IpAddress (ip: 192.168.1.110). It cannot be forwarded to 2 different internal IP addresses, unless you tell people to use a different port number for the second sites domain name so that you can forward that other port to your second PC's port 80.
This leaves you a couple of possibilities :-
You either setup the original PC's Apache as a Proxy for the second PC and therefore forward accesses for the second site to the second PC while still running the first site on the first PC
Or, more simply in my opinion you stay with One PC running WAMPServer and you make use of Apache's Virtual Hosts capabilities.
This way as long as you have 2 seperate domain names, both pointing to your Routers WAN IP address both can still use port 80 i.e. Users dont need to add a port number. Apache will decide what site is required and run that site by simply looking at the domain name and redirecting everything to the right place.
See this post for some help on how to setup Virtual Hosts in WAMPServer
Its should only take a few minutes to setup.

how to access local web application on glassfish server from internet?

I have created a web application in glassfish and I can access it on my LAN.
How can I access the web application from a remote location over internet?
I do not have static IP.
Please reply.
Thanks.
Steps :
Creating virtual DNS(Domain name server) Server on your machine.
Port Forwarding.
Reference https://cookbook.fortinet.com/port-forwarding-60/
Remote Desktop Connection enabling.
Creating Inbound Rules. Reference :
https://www.howtogeek.com/112564/how-to-create-advanced-firewall-rules-in-the-windows-firewall/
Creating account on www.noip.com and create custom host and download DUC (Dynamic Update Client) Software.
Some more steps may have it depends on your LAN Router and firewall configuration.Use http://ifconfig.me/ to get your public ip.
Access from outside your machine should be configured by default. You may check if it is so in admin console, at Configurations->server-config->Network config->Listenters. There should be one listening on the desired port (like 8080) and be bound to 0.0.0.0 address.
To easily access something behind a dynamic ip you need something like http://www.noip.com/ or http://www.dnsomatic.com/ (I took these from my router's control panel)
I did this recently,
first you need to use port forwarding on your router, access it by typing your default gateway path, mine was 192.168.0.1 then go to "advanced settings -> Port forwarding". Simply enter the details that are asked for, I set mine to HTTP using port 8080, yours might be different. Protocol is TCP. The IP address it asks for is your local address.
For quick testing you can disable the firewall on your machine and then you can search on google for your Public IP address by typing "what is my IP".
Then type your ip into the browser and the port number "ipAddress:portNumber"
You should see the glassfish welcome screen if it is successful.
After that you might want to enable your firewall again but then you have to add an inbound rules to allow the port to be used:
Setting Windows inbound rules
Then you still have one last step to perform, allowing glassfish to access the resources on your machine: Adding glassfish to allowed programs
Follow the instructions on adding java.exe only.

Hosting site using xampp server from local network without port-forwarding

I want to make my site available world wide. Im using xampp server for hosting. I have no access to any kind of servers and modems. Situation is shown below:
My site server has local ip assigned by wifi router and it runs Windows 8.
Remember I have no access on any kind of servers and modems so port port-forwarding is impossible (out of my scope).
Its actually difficult, but not impossible.
One way, I would approach this is:
I would host a page on internet.
Then take request and store it in database.
One of my program will always be running from my computer.
Then check for request and curl the request to localhost. For this you may use Node.js (taking data from database using GET method and curl it to localhost).
This is the best I could think of. And I am working on it, when the code is ready I'll make it open source and notify you :)
But still, it's difficult, as you need to put user's request to sleep for 2 seconds and then transferring it.
Its slow, but may work out for you.
Disadvantages:
Program will be very slow and memory usage will be more.
Breaking may happen many times.
High bandwidth wastage
If not encrypted, MIM (Men in Middle) may possible.
Advantages:
Indirect method of hosting
Need not to worry about your code being lost.
I am looking forward for a better alternative and I would like to keep this question for bounty once again.
If you cannot open the necessary ports within your LAN you will require access to an external server. However, the external server does not need to host any code, e.g.
Create a Linux based ec2 instance using Amazon's free tier.
Install a package to redirect remote to local ports:
a. using socat:
Install socat using your distributions package manager
Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu#xxx.xxx.xxx.xxx -N -R 8080:localhost:80 "socat TCP-LISTEN:8080,fork TCP:127.0.0.1:42500"
b. using a webserver and reverse proxy:
Install apache or nginx and any required reverse proxy modules and configure your VirtualHost to proxy requests to a local port, e.g. :8080 -> 127.0.0.1:42500
Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu#xxx.xxx.xxx.xxx
Your machine is now reachable via the ec2 instance http://xxx.xxx.xxx.xxx:8080/.
I occasionally use this technique when debugging web service callbacks.
Update 17-02-2014
If you are a Windows user you will need to install a third-party tool to support ssh. Options include:
cygwin
git bash
PuTTY
PuTTY is the easiest choice if you are not familiar with *nix tools. To configure remote port forwarding in PuTTY expand the following setting: Connection -> SSH -> Tunnels. Given the previously described scenario, populate Source port as 42500, Desination as 127.0.0.1:80 and tick the Remote option. (You may also need to add the path to a PuTTY compatible private key in the Connection -> SSH -> Auth tab depending on your server configuration.
To test you have successfully forwarded a port, execute the command netstat -lnt on your server. You will see output similar to:
tcp 0 0 127.0.0.1:42500 0.0.0.0:* LISTEN
Finally you can test with curl http://127.0.0.1:42500. You will see the output of your own machines web root running on port 80.
if you don't have a public IP address and cannot use port forwarding it is impossible to host the site
As people have said you need a public IP address. However, even if you did you should not use xampp as a public server, as it is designed for development and therefore has some security settings disabled.
I would recommend buying some shared web hosting, and uploading it to that. (you can get cheap hosting if you google 'shared web hosting', plus free .tk domains are avaliable: http://www.dot.tk/)
Do your company has any vpn network?
If it does and you have access to the vpn network, you can include your server to the vpn network and your guest will only need to login to your company vpn network then access your site like in a local network without using port forwarding. And since your data is very confidential, I assume that using vpn will also help to increase the security of your data.
Please correct me if I'm wrong.
Thank You.
What you are asking is not possible without port forwarding.
Lets break it into steps.
To host your site locally you will need a IP that is static so that
users can access it specifically.
You will need a domain so that it can be converted into user friendly name.
A 24x7 Internet Connection is must! You added a Wifi Router in your Diagram and most of today's router are capable of port forwarding.
What i will do in your scenario is:
Instead of using XAMP, i will install WAMP because i am more familiar with it and easy to configure.(totally personal preference)
Then i would set my server "ONLINE".(Google how to set WAMP server online)
Forward port "80" from router settings to my local computer ip address.(mostly it is tagged as "Virtual Server","Firewall","Port Forwarding",etc vary router to router in settings)
Suppose you have a local ip "192.168.1.3" and global/router IP "254.232.123.232" then you would redirect all the HTTP request done towards router to your local IP.
[[[[254.232.123.232]]]] --+ :80 +-- --------->192.168.1.3
That is good for now, but then you will need to tackle dynamic IP problem of router. But don't worry, thanks to some free sites that will be easy!
Go to no-ip.org -> Setup Account -> and create a entry, just a subdomain for now to test whether everything is working fine.(subdomain like mysite.no-ip.org, later purchase a real Domain)
Input your IP address there(Router IP) and download its application which will automatically update their server if your local IP changes.
Wait for some minutes and Voila! Your site is live.

Apache server doesn't work on external IP (ports are forwarded)

Here is my situation, step by step:
Apache 2.2 on Windows 7
Restarted the apache server plenty of times up to my latest changes being described here
Changed apache's port from 80 to 8080. There is only one "Listen" for 8080 and not for other ports like 80
Type localhost on browser and doesnt work as expected
type localhost:8080 and everything works perfectly
go to http://www.yougetsignal.com/tools/open-ports/ and http://www.canyouseeme.org/ while apache is running, they report port 8080 is open
type my external IP (the same one reported by yougetsignal.com above) followed by :8080 and get "this webpage is not available"
Windows firewall is completely turned off during these tests
People that access my external IP actually get my router asking for user and pass authentication (I have no auth requests on htaccess or config)
What on earth could be causing the external ip not to work properly?
The problem is that from outside your network your ip external address directs traffic to your router since it is the first thing connected to your modem. This is why some of your users saw your router page. You will need to setup port forwarding in your router to forward requests on port 8080 from your router directly to your computer where you are hosting the site. Note: There are some potential security risks with opening ports which can search online.
Here is an example instructional video, or you can search for other port forwarding instructions online.
http://www.youtube.com/watch?v=Kp-R-eHiQco
From there you will also need to open the Windows Firewall ports for port 8080 (or turn it off) as you have done. That should do the trick.
Found two different problems:
My router always has port 8080 open, whether I forward or not. It could be using it for something internal which was conflicting with apache. So my advice to everyone out there, make sure you pick a CLOSED port to use on apache to begin with
I changed to port 4000, and tested it. Didnt work for a minute, messed with settings, went back to original 4000 setting and bam. Works. Turned server off, turned back on, still working and port is open. As I suspected, turned server off, left PC on, went to take a shower, came back 10 min later, turned server back on and not working anymore and websites list port 4000 as closed.
So it appears that my router is inconsistent, sometimes he can open the port and sometimes cant for some reason.

How to set up an internal website?

How do I set up a website that's accessible within a small (office) network? I've only worked on localhost (using WAMP) so far and have no idea where to start. Also, is it possible to access that website through a pseudo domain name/alias instead of an IP?
This is of topic here - and wil be covered by lots of basic set up tutorials.
It's exactly the same process, except you need to ensure that clients on the lan can connect to the webserver runing on port 80 - i.e. make sure your firewall isn't blocking the access and that apache is listening on the LAN interface address (the default configs are usually to listen on all addresses).
is it possible to access that website...
Yes - just publish a DNS record for the webserver in your DNS server - or add it to the hosts files on all of the clients.