Access virtual host from a local virtual machine - apache

I have a virtualhost called project so in my localhost I access http://project and everything is ok, the webserver is in Apache 2.2 in Ubuntu 11.04. Then I need to test this project on Safari and IE, I have a Virtual Machine with Windows XP in the same computer (using VirtualBox).
How can I access to my virtualhost from the virtual machine? I've tried http://project from IE in the virtual machine and it didn't work. I could try http://192.168.1.20/project (my local ip) it work but I really need to access with the virtualhost name (http://project) because a lot of code and rewrite rules only work when I use http://project
Thanks

As an administrator, edit C:\Windows\System32\drivers\etc\hosts on your XP virtual machine and add the line;
192.168.1.20 project
After that, you should be able to access it by host name.

Related

How to remotly access a custom wampserver's virtual host in a local network?

I use Wampserver 3.0.6 under windows 10 and I want to share my application between my personal PC (The host) and some other computers linked to the same home network (Clients).
I changed a line on httpd-vhosts.conf file to let the application be accessible from other machines in the network from this:
Require lacal
to this:
Require all granted
The problem is that the default virtual host (localhost) is accessible from those clients using the host's ip adress like this 192.168.###.###/ but not my customized virtualhost (tilelli on this case). Here is the content of httpd-vhosts.conf file now:
enter image description here
I tried to access it via 192.168.###.###/tilelli/ and directly via tilelli/ but didn't work.
Can anybody help me please ?
If you define a Virtual Host Servername as tilelli then Apache will serve that site when it sees that domain name in the connection request i.e. http://tilelli.
If you have a local (company) DNS Server, add that domain to it, pointing to your WAMPServers PC's IP Address. If you dont have a local DNS Server, then change the HOSTS file on the PC's that need to see this server so they know where to look for it
HOSTS FILE
192.168.xxx.yyy tilelli
You do have to change each and every one of the other PC unfortunately.

Access virtual host on apache without host redirection?

I have apache 2.4 installed on Ubuntu server 14.04 and have setup different virtual host like domain1.com,domain2.com,domain3.com. The web server is meant to be accessed only from local network. So I tried to edit /windows/syste32/drivers/hosts and added line like this
192.168.1.90 domain1.com
and can now access the domain1 from that machine by simply putting domain1.com in browser. However I wonder if I can access specific virtual host on apache without editing the hosts file, I mean entering something like this in browser
192.168.1.90/domain1.com
, but this doesn't work since apache tries to retrieve content from the default host. In other words: If I know the apache server ip and virtual host domain, can I access it via browser directly?

Website in lan with virtual host?

I have a specefic problem, i have more websites on my localhost server (xammp), they has a virtul host, but i want to access this websites trough lan or wlan because so i can test it on mobile devices. If i call only ip on other device then i see xammp control panel, but i don't know how can i call websites in lan like: "site1.local, site2.local, site3.local", are here static ip's needed? On the router is DHCP enabled. I read few topics and this is all clear for me, the problem is only access on this sites trough network.
Read topics:
How to set up Apache virtual host such as http://home/, http://office/, etc
Accessing localhost (xampp) from another computer over LAN network - how to?
How to set up Apache virtual host such as http://home/, http://office/, etc
Apache: see named virtual hosts from LAN
Find your IP of your server machine. If it uses windows, press start then type into the search bar cmd. Then when a command promt comes up type in ipconfig and hit enter. Look for "IPv4-address" and to the right of that is your local IP of your computer.
Then you can use a computer on your wireless LAN or a wired connection. Simply type in the IP of your computers local IP with XAMP, and you are good to go!
Hope this helped
-Kad
I do this on work for testing. We have a XAMPP localhost server. My projects are in the htdocs folder. like this: c:\xampp\htdocs\niceproject
The IP for reqesting xampp is something like this: 192.168.10.104.
Now for calling the Websites just do this: 192.168.10.104/niceproject
I hope this is what you are looking for.
To access multiple sites (virtual hosts) served from one machine (say lanwww running apache) on mobile devices the usage of ServerName (say site1, ServerAlias site1.lanwww) fails - the DHCP on the router won't map subhosts (site1.lanwww). I found that using different ports for the subsites works nicely though - remember to add appropriate Listen statements to the ports.conf. The configuration of other webservers is left as an exercise to the reader.

Virtual host not accessible in intranet

Could it be possible to create a virtual host using tomcat and apache which can be accessible in an intranet ??
I am a newbie in using jsp and tomcat but I have been able to create a virtual host, but it is not accessible in the intranet. What do I have to do to make it accessible on the intranet?
This is possible to create a virtual host using tomcat and apache. But in order to make it accessible in the local intranet you need to add an entry of your ip address to the /etc/hosts file of the memeber machines of the intranet unless they will not be able to recognize the virtual host you have created.
Which is not feasible at all because the /etc/hosts file is managed by the root itself and it is refreshed on every restart by root. You can add a sticky bit to the file but it is like an intrusion to the machine/company policies which should not be done.
:)

Accessing local apache server from virtual box

I have apache installed on my machine. And I have windows xp installed on virtual box in the same machine. Can I share apache between them?
I'm running a virtualbox with w7 on wxp. On the host (wxp) i'm running a local apache install.
I can access the host apache install from the guest system using ip 10.0.2.2.
I've added an entry to the guest hosts file (windows/system32/drivers/etc/hosts) pointing the domain i want to test to the ip above. Thus:
10.0.2.2 www.domainname.com
From my guest w7 system i can now access www.domainname.com, which is now served from the local apache on my host system. This works including mysql db support on the host.
I found the ip number in this thread: https://forums.virtualbox.org/viewtopic.php?f=8&t=44068
Hope this helps.
yes but you have to configure the network of the XP VM to "Bridge". Then you can access your Apache server on the host machine with the browser on the XP VM (http://192.168.0.24 for example). Both the host and the VM are on the same network then.
What do you mean "share"? If you've got an apache installation on your main system, you can browse to pages served by that installation.
If you've got a virtual machine with windows XP on it, and its own apache installation, that is a seperate installation. You can do port forwarding to that virtual machine, so you can access that too.
For instance, you can have have Apache 1 (main system) running on port 8112, and Apache 2 (virtual machine) on 8113, etc...
I guess you could put htdocs in a shared virtualbox folder, so you can update site contents from both systems, but they still would be served by seperate apache installs.