LAMP stack on home computer as a public web server - php

So I'm using this website:
http://www.howtoforge.com/ubuntu_debian_lamp_server
to setup LAMP on my Ubuntu Virtual Machine.
Here is my question though,
This will enable me to program and test through localhost. How can I set this up so anyone on the web can access my .php pages from any Internet capable device, and they will still interact with my local database, etc?

If you open port 80 in your firewall to your local machine, it should be available to the outside world via your ip address. You will need to check your router settings to figure out how to do this, but usually it's called port forwarding.
You could then use a free service like dyndns to give yourself a domain name that you can then type into your browser such as
myserver.dyndns.org

You have a couple of options...
1) Find a site that hosts LAMP and put you site up there. Many of them allow you to register a domain name and they manage the machine.
2) Do what Ben Rowe suggested, use a DNS forwarding service (Some are free, some not). Host the site on your own machine, some ISPs do not allow you to use port 80, you might need to use another port.

Related

Server data accessing from non local network without port forwarding

I'm using XAMPP server and I have my files in htdocs folder of XAMPP.
I had connected to my laptop using my mobile hotspot.
Can I access my files in XAMPP folder from another system which is not in same network i.e., can I access the files present in XAMPP folder from another another computer via internet
without router only by mobile hotspot?
Yes, it's possible to access the web server from an external network, depending on your current network configuration.
There are two simple solutions I think would suit you.
Configure your firewall if needed, enable port forwarding in your router settings to forward port 80 to the internal IP of the machine running your XAMPP-server.
If you're on a network in which you can't configure, I recommend checking out ngrok.com, which is a service where you can setup a public URL for your XAMPP-server. Works from any type of network, where you have internet-access, of course.
Note, alternative 2 is good for exposing a development-server, nothing I'd recommend for running a site in production.
Most network providers don't allow accessing the termials in the network.
If your provider does portforwarding and entering the public(!) IP of your hotspot should bei enough.

PHP server on PC

I want to make a php application and it must host in a computer and open from many branches of my schools using web.
I installed XAMPP on my pc server, and if i try to open the application in the same LAN network it works, but if i change the network it is not working.
The browser say that ip 192.168.1.22 take large time to load and not open.
how can i config that problem please
You need to set up a static IP on your machine, then set your router to forward ports so that all requests that come to your router on a particular port would be forwarded to your machine. This should do for testing purposes, but if you want to host a website for example you will need to get a permanent static IP for your router, this usually costs money from your ISP(internet service provider).
192.168.1.22 is your local IP address, you cannot access it from a different network. You can get your external IP address for example using whatismyip.com. Also, if you are behind a router, you have to open and forward the port which is used by your web server to your machine.

How can I bring my server online?

I don't think if it's possible, but I would like to bring my server temporarily online.
The thing is, I have been working on a PHP project lately from my home computer, and I need to show the progress to my follow team mates on their PC. Unfortunately I cannot go to them, but I wish if my website could.
We don't have a registered domain for it yet.
It's an APACHE v2.0 server installed, running PHP 5 and MySQL at the same time.
Is there some way I could possibly do that.
I heard some where that it's possible with Forwarding ports on DNS using static IP address or something like that. I am using Internet Connection using a HUWAEI Data Card Modem Model: E1550. Unfortunately, I cannot forward ports wit hit.
Any possibility I could share the website temporarily?
Why not just open up a free hosting account on a real good free host service like 000webhost, export your local database, upload your site to the remote host using ftp, then import your databases export file into the remote host's mysql and share the link to your site with your buddies?
That's what I do.
Install and set up Apache properly
Forward port 80 (or other, if you want) to your local IP, through your gateway settings
Register with your IP on DynDns.org or no-ip.org or something like that.
Edit: Well, you said "temporarily", you can just forward port 80 to your local IP and be happy with your "http://xxx.xxx.xxx.xxx/" but beware that it will change whenever you restart the router, or reestablish the connection.
What #MarkoD said, but until then -
If you have access to your router's firmware, you forward ports from there, not your actual PC. Just forward the port Apache is listening on, then put WAMP/XAMPP online.
Once it's online, share your IP and the port you chose with your team mates and they should be able to connect.
The link should look something like: http://111.111.111.111:2222.
For example, Cox Communications doesn't allow outgoing data on port 80 or 443, so use 8080
http://111.111.111.111:8080
If your ISP does, then just use 80 and drop the :xxxx.

How can I access my localhost server from other computers?

I'm new to PHP, so I don't know how to explain it. I'm running WAMP on my computer and I would like to be able to access my localhost from another computer.
Is it possible? How can I do this?
This is provided that all machines are on the same network and that you have
administrative privileges on the machines (you'll have to edit some system files).
You can easily do this but it would have to be a manual process.
You have to create an entry in the hosts file -
On Windows machines is is located in %SystemRoot%\system32\drivers\etc\hosts
On UNIX like systems it is located in /etc/hosts
http://en.wikipedia.org/wiki/Hosts_(file)#Location_in_the_file_system.
See the link for details on where your hosts file is located. It depends on the operating system.
The following will have to be done on every machine that you would like
to have access to your localhost machine.
Add a line at the very end of your hosts file similar to this :
10.0.0.42 prathyash-localhost.com
The IP address (in the example above it is 10.0.0.42) is the address of your localhost; Your computers IP address. The domain name (prathyash-localhost.com) is what is mapped
to the IP address.
After you save that file, whenever that computer points to prathyash-localhost.com, it will be directed to your IP address. Firewalls are still a barrier - however the other answers covered that so I will not repeat their contribution.
Depending on your situation, manually editing tens maybe hundreds of files might not be feasible. In this case, you might want to consult the networks administrator (he probably hangs around on Server Fault), and he may have a better solution for you.
This problem can be fixed as follows.This is for one using a wamp server or a similar local server.
first ensure that you have modified the httpd.conf.scroll until you find this line:
# onlineoffline tag - don't remove
Order Allow,Deny
Allow from all
If you have a smartphone turn on your wifi hotspot to connect with your pc and the one you want to connect with.
Open the command prompt in your pc and type ipconfig. Note down the ip4 address of your pc (eg. 192.168.43.47) under wireless LAN adapter Wireless Network Connection.
In the pc you want to connect to set "Obtain IP address automatically".
Before you connect ensure your wamp server is online.
Open the browser of the client pc and type the IP address noted down earlier.This should work just fine. In some cases you may be required to switch off your antivirus.
Yes if they are on the same network, simply target the computer's IP address and ensure anything on either computer that would block access to port 80 (firewalls) is off
#Shaun Hare explained it pretty good, however, if those computers are not in the same network (my case, when remote presentation is needed) you would also need to set port forwarding on your router and remote side would need router's public IP address.
Basically, remote side would enter http://123.123.123.123/index.php in their browser and router would point that request (via port forwarding) to WAMP server installed at 192.168.10.10 (for instance).
You can't. Bind the appropriate daemon to 0.0.0.0/:: or an external interface and use the machine's IP address.
If it's for testing you could use a service like http://localhost.run/ or https://ngrok.com/ to temporarily put localhost on the internet.
Post forward port 80 on your router configuration. Start wamp. Now when your IP address is accessed from any external machine it will jump to the "www" folder and show the index file. If you are not able to do so, it means your firewall is blocking the request: Disable it and try again.
You could just tinker around the firewall. I found that the inbound and outbound rules were blocking all public network traffic (that is, all traffic to my router which is seen as public, even though it has a password) and proceeded to check the box to allow traffic on a public network (both inbound and outbound) for all the rules bearing the Apache name. Also, I did turn on the mySQL server, but that shouldn't do anything at all in this matter (though life has surprised me like this before where something insignificant turned out to be quite significant in the end, so I would do this as a last resort, but unlikely). Also, I think this should work at least over the same WiFi network (and I know that's a part of LAN, but just to clear up any ambiguity) since I only tested with my Android phone (oh how I wish I had a Windows Phone). Hope this of any use to anyone!

Setting a website via home server

I tried Google and it failed.
I want to set up a localhost website from my computer that people from the Internet can access...
I am using Windows Vista (64-bit). I use WAMP but am open to others... I plan on using no-ip.org for DNS.
If anyone knows of a definitive guide.. please let me know -- thanks
If you are able to setup WAMP and access your webserver using "localhost," you will need your IP. If people cannot access the IP, make sure you allow these daemons to run through Windows Firewall and if you have a router, you may need to do some port forwarding (very simple) or, if this computer is always public access, look into DMZ (demilitarized zone) to remove the computer from the router's firewall.
An easy WAMP solution is using XAMPP which is an all-in-one package.
Step-by-step guide:
http://www.dkszone.net/install-xampp-windows-step-step-guide
You need:
a webserver,know your IP adress.
If dynamic.. Dynamic DNS, this will bind your new routerIP to a domainname
make sure your router allow traffic by the port 80 and you are done!
ppl will access your home server just by setting the dynamicDNS domain.
Key points-
0) To install IIS on vista: http://www.howtogeek.com/howto/windows-vista/how-to-install-iis-on-windows-vista/
1) Your cable/dsl company has to open port 80 for you, or else it will not be accessible outside of your house.
2) You're router will have to forward port 80 to the server. You can find out how to do that here: http://portforward.com/english/routers/port_forwarding/Linksys/BEFSR41/BEFSR41index.htm
3) before picking a dns service, check if your router supports one, it is the easiest way to maintain it.

Categories