Apache 2 + virtual hosts on different folders - apache

I have a folder named www with my applications:
/www/app1_folder/
/www/app2_folder/
/www/app3_folder/
Also I have one external ip and domain name www.example.org*.
If I refer my apps without virtual host settings It looks:
http://www.example.org/app1_folder/
http://www.example.org/app2_folder/
http://www.example.org/app3_folder/
But problem is my apps share a session environment.
I would like to save the approach of my apps referring (i.e http://www.example.org/app1_folder/, ...) without sharing of environment.
I hope it's possible with virtual host setting of apache.
How can I make virtual hosts based on different names of folder (i.e. app1_folder, app2_folder, app2_folder)?

A virtual host is defined by a domain name (foo.mysite.com) and a port (:80, ...).
You cannot create several virtual hosts by using the same domain name/port.

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.

Change virtual host directory based on IP address

Is it possible in Apache to change the Directory parameter based on the users IP address (i.e. in htaccess)? The logic is that if I'm building a test site it would be great to see it in a test mode for my IP but keep it live and unaffected for public users. That way effectively one domain can appear differently without changing the site root path. Thanks.
You will need 2 virtual hosts, that way you can set a different document root and path for the hostnames. You can restrict acces to your test environment using htpasswd, or put your ip adres in your test virtualhost on the allowfrom list and deny acces to everyone else.
This way you can create urls like test.domain.com and domain.com resolving to the correct environment.

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.
:)

How to set up Apache virtual host such as http://home/, http://office/, etc

So rather than http://localhost, is it possible to set up multiple virtual hosts on the same local computer so I can access:
http://home/
http://office/
http://docs/
for different websites that are hosted at different document root directories in my computer?
Install multiple virtual hosts
Check this page for a useful information on what you want to know.

apache virtual host question

After i 've set a virtual host in httpd.conf,
why i still have to set the virtual host in domain registration organization?
I'clarify
for example , i've set phpmyadmin.mydomain.com as virtual host in httpd conf file, next, i've to go to http://www.dyndns.com/ to add phpmyadmin.mydomain.com as A record, so phpmyadmin.mydomain.com will be accessible.
After i 've set a virtual host in httpd.conf,
why i still have to set the virtual host in domain registration organization?
These are two separate tasks because they touch entirely different areas.
DNS records tell the world that domain A is now reachable on IP address B (Imperfect real world analogy: an entry in the phone book)
The VirtualHost directive tells the server software running on the server how to deal with incoming requests to that domain. (Imperfect real world analogy: Your name on the doorbell of a large house, and on your mail box in the hallway of the house.)