LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2012, 10:45 AM   #1
gammaman
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Rep: Reputation: Disabled
connect to local host on Ubuntu Server from Windows.


Hello, I am very new to linux an I am trying to learn. I have a computer that is running windows 7. On that computer I have installed Virtual Box which is running Ubuntu Server. On the Ubuntu Server I have installed apache2 and php5. If I look at the /var/www I am able to see the index.html which contains the sample "it works" file. I am trying to now connect to this local host using firefox via Windows 7 browser. I have already tried using ifconfig to get the ip address. When I tried to connect from the Windows Browser it timed out. What am I doing wrong, how can I do this?

Last edited by gammaman; 02-05-2012 at 10:46 AM.
 
Old 02-05-2012, 11:26 AM   #2
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
In VirtualBox, in 'Network' settings for that VM make sure network adapter is set to be attached to bridged adapter (rather than NAT), boot up VM and check what IP your DHCP server (presumably your home router) has assigned to it. Then in Windows stick that IP as a URL.

(And it's not 'localhost' in that context)
 
Old 02-05-2012, 11:44 AM   #3
gammaman
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
OK, this is working great!! However what would I do if I had an apache server also running on my Windows Machine. How do I tell the browser which one to point to? Would it get assigned a different ip? Also I know apache is for mysql database. If I wanted to connect to an Oracle database, what would I use instead of apache?

Thanks for your Help!
 
Old 02-05-2012, 11:55 AM   #4
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
"However what would I do if I had an apache server also running on my Windows Machine. How do I tell the browser which one to point to?" - that's your localhost if you are connecting from the machine Apache is running on (i.e. Windows). Or you can use IP 127.0.0.1 (which is the same as localhost) or you can use your LAN IP (usually something like 192.168.x.x or 10.0.x.x).

"Also I know apache is for mysql database" - no. Apache is a web server and has nothing to do with MySQL which is a database server. You can use any other web server instead of Apache - Nginx, Lightpd, IIS etc. To connect to a database server your application uses a connector/module like php5-mysql.

"If I wanted to connect to an Oracle database, what would I use instead of apache?" - see above, this question does not make sense (Apache can still be used, connecting to Oracle DBs is not dependent on a web server in use).

Last edited by klearview; 02-05-2012 at 12:03 PM. Reason: clarification, grammar
 
Old 02-05-2012, 12:16 PM   #5
gammaman
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
OK, I am still confused about one thing. Why is it that when I shut down my vm and virtual box, I am still able to connect to my local host and view the "it works page"? If apache is running on the vm and the vm is shut down, apache web server would also not be running right?
 
Old 02-05-2012, 12:24 PM   #6
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
Localhost - is your local machine (a local host). So when you enter 'localhost' in a browser's address bar, you connect to port 80 of that machine where the browser is running on.

"If apache is running on the vm and the vm is shut down, apache web server would also not be running right?" - right, but you are not trying to connect to VM, are you, if you are connecting to localhost
 
Old 02-05-2012, 12:55 PM   #7
gammaman
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Ah, I see now. Thanks for being so helpful. I have one more question. I am trying to upload files to Ubuntu Server via WinSCP which is on Windows. I have used the hostname command in Ubuntu to get the correct hostname, and I know my username and password are also correct but it when I try to connect it says connection refused. Could I by using the wrong port number(22)? If so, how do I know what the port number is?
 
Old 02-05-2012, 01:04 PM   #8
gammaman
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Never Mind, I forgot to install ssh. Sorry my bad.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to connect Windows host with guest ubuntu via network pawan613 Linux - General 4 11-27-2011 04:06 PM
Please help me setup Local Area Network. I cannot ping Windows XP host from Ubuntu 9 avarashnon Linux - Newbie 1 05-10-2009 07:59 PM
Using a local NX server to connect to a Windows terminal server on the Internet? roystonlodge Linux - Networking 1 07-26-2008 04:17 AM
cant apt-get, cant connect to local host 2Pacalypse Debian 4 06-30-2007 03:24 AM
smb:\ cant connect to local host?! ratbert90 Slackware 2 10-30-2003 05:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration