Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 3421  / 2 Years ago, thu, october 6, 2022, 3:52:04

I am new to Ubuntu and have Apache2 running in a virtual box on my machine. I am trying to access this server on my Windows machine.. I am assuming that I need to find the ipAddress and the port to access the server.



I have tried Identifying my IpAddress using the following



lfconfig



enter image description here



enter image description here



And then checking which port Apache is running



lsof -i etc..



enter image description here



I'm not really sure what all this information means.. But I am assuming that If I find the Ip Address and port I can navigate to it on my windows pc. e.g. http://10.0.2.15:27017



Anyway I have tried just about every cominbation of ipAdress/port listed and can't figure it out.



Do I need to implement any port forwarding? I found the following screen in my vm settings but don't know what to try from there.



enter image description here



Would appreciate any direction or guidance on how I can access the apache2 server.


More From » networking

 Answers
0

There are a number of factors at play, mainly your Apache configuration and the network setup of your VM.



You are on the right track with the Apache setup, but I would use netstat to find the port your Apache is listening to:



gomo@wks120:~/$ sudo netstat -puant | grep apache | grep LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1577/apache2
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1577/apache2


This shows I have a process called apache2 with PID 1557 listening on port 80 and 443 on all interfaces (0.0.0.0).



For the network setup part, it depends on what type of networking you are using for your virtual machine (found in VirtualBox under each VM's Settings --> Network page. The most common options are either bridged or NAT.



Bridged means the VM will be granted access to the physical network your host computer is connected to. Things would work as if you plugged the VM onto the same switch your computer is plugged in to. You typically run virtualized servers this way.



NAT means a local network will be created just for your VMs. This is similar to how your average home router/wireless AP works: VMs can access outside networks (such as your LAN or the internet) but other computers can't reach your VMs.



All in all, set up bridged networking (restart the VM's network or the entire VM after changing this) and check your apache port. You should be able to connect without problems from your host machine.


[#27558] Thursday, October 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
atetamme

Total Points: 11
Total Questions: 121
Total Answers: 109

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago
;