I can see my "website" locally but how do I get it to show up online? Does it need a domain name per se or can't I just get DNS somehow to pick up my IP address and put it online or something, I don't know. I've got a domain name registered, if that helps.
-
You will probably need to set up your router to forward port 80 traffic to the server and then just connect with your public IP address :)– SethJun 30, 2014 at 23:08
-
How do I do that, though? I'm looking online and it's not clear how how I do this given a LAMP setup (and I am also using VirtualBox if that matters)– user51819Jun 30, 2014 at 23:14
-
1You mean to say, your "website" is hosted on a (virtual) server within VirtualBox?– MarcusJun 30, 2014 at 23:18
-
Yes. Sorry, I don't know the jargon too well. I can go to 127.0.0.1 and see whatever I write in /var/www/html/index.php, all of this in VirtualBox. However, I want to be able to see that index.php file from any other computer now (i.e. hosting it online from my machine).– user51819Jun 30, 2014 at 23:21
2 Answers
Access your website from outside your computer
If I understand correctly, you have a virtual machine containing an Apache server hosting the default "It works!" page. In order for this to be accessible from the Internet, it must first be accessible from outside the host machine (the host machine is the one running the Virtualbox software).
To do this, open the virtual machine's Settings
dialogue, and from the Network
tab choose "Bridged adapter".
This will give the virtual server an I.P. address on your network which you can discover by running ifconfig
from the server - look for the address following inet addr:
, it will probably be something similar to e.g. 192.168.1.10. Then, type that I.P. address into the host machine's web browser and you should again see the "It work!" page.
Access your website from the Internet
At this point, all that's necessary to access it from the Internet is to change settings on your home Internet connection's router so that, rather than blocking incoming web traffic, it directs it to your new server. This is called 'port forwarding' and is standard fayre on most routers, just log in to your router's web interface and you will find it. (You may need to keep that I.P. address handy.)
However
It appears from your question your knowledge is really quite basic, and rather than playing with putting it on the Internet, I would advise you to keep things local (just on your home network). One slight misconfiguration on an Internet-facing server can be catastrophic.
-
I wouldn't play around with it online -- I just want to see that I know how it's done. All experimentation is going to be done in my VirtualBox otherwise. Jun 30, 2014 at 23:59
-
Right, it would be a good thing to stick it online for a minute or two and see if you can access it from elsewhere (ask a friend to, for example). But do make sure to change your router settings back when you're done:). If this works for you, by the way, don't forget to accept the answer.– MarcusJul 1, 2014 at 0:01
-
Awesome, I can see it from my Windows machine (192.168.1.9 in my case) -- how do I direct it to a server? Do I go into my namecheap account to do this? Jul 1, 2014 at 0:02
-
You've never mentioned namecheap, but you really don't need a domain name or any DNS interaction to test if your website will work online or not. If you would like to, afraid.org will allow you to point domains to arbitrary IP addresses for free, but you need to make sure you can access the "It works!" page via your router's external I.P. address first, which you can only do after you've got your router's port 80 forwarding correctly.– MarcusJul 1, 2014 at 0:05
-
Right, makes sense. Currently trying to figure out how to forward the port via Verizon (router page) Jul 1, 2014 at 0:12
When you say that "I can see my "website" locally" I understand it as - you have a computer that you are using for development purposes at home - "put it online or something, I don't know." which I understand as you are trying to get the same thing on your computer as in publish your website. If this is the case then yes you do need all that stuff hosting and a domain name. If you are configuring a server then I would suggest you re-word this question to make it clearer.
-
1
-
Just trying to establish what the user is trying to do. As you can see even with the answer the user then comes up with "namecheap". Jul 1, 2014 at 13:05