Score:0

Multi sites hosts on a virtualbox webserver

mq flag

I have a LAMP server on Kubuntu running in virtualBox (NAT network). I have two sites site1.conf and site2.conf too create virtualhosts I have modify hosts to have access localy site1.local and site2.local That work fine and i can access with my kubuntu webbroswer to my two sites.

If I try to access my site in my guest webbroswer (127.0.0.1:8080) with port forwarding (because nat configuration in virtualbox) i can only access site1 Now i want access site2 in my guest webbrowser. I try modify hosts in guest but that do not work

How can i do ?

Score:1
br flag

The only information the client sends to the server via http(s) protocol is the "host" and the "path". From this the server has to find out what to send back.

How should a server know from the information "127.0.0.1" which of your sites (site1.conf or site2.conf) you want to access?

You need two different "names".

Add "127.0.0.1" as "ServerAlias" to "site1.conf" and "127.0.1.1" as ServerAlias to "site2.conf".

Now you can access site1 with "127.0.0.1:8080" and site2 with "127.0.1.1:8080".

All IPv4 addresses in subnet 127.0.0.0/8 are "localhost".

Gaëtan BILLON avatar
mq flag
Hello, I try, but seems not works. I try : ServerAlias 127.0.1.2 in site2.conf When I try http://127.0.1.2 in windows, i have a error message
Marco avatar
br flag
Windows ? This only works in your "guest".
Gaëtan BILLON avatar
mq flag
Hello, I try, but seems not works. I try : ServerAlias 127.0.1.2 in site2.conf When I try http://127.0.1.2 in windows, i have a error message ("Forbidden You don't have permission to access this resource.")
Gaëtan BILLON avatar
mq flag
Think my firest message is not clear( i m French sorry)
Gaëtan BILLON avatar
mq flag
VirtualBox is working on windows with i linux server i can access my two site in linux interface but only site1 in windows
Marco avatar
br flag
"localhost" always points to the computer itself. You can not access another computer with "localhost".
Score:0
mq flag

The answer is correct Make an ServerAlias works Thank you

TiloBunt avatar
ao flag
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/1311554)
zx485 avatar
us flag
Please don't add "thank you" as an answer. Instead, **[accept the answer](https://askubuntu.com/help/accepted-answer)** that you found most helpful. - [From Review](/review/low-quality-posts/1311554)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.