Configure apache virtual machine in Linux-php Tutorial

Source: Internet
Author: User
In Linux, after configuring the apache virtual machine, I first installed apache in linux by compiling the source code, I want to configure a virtual machine, just like using different domain names in windows to locate the root directory of the site that cannot be located. People who have done this should be able to understand that the following is my configuration in linux:



According to the above configuration, if I modify the DocumentRoot path and access it with the IP address 127.0.0.1, we can locate the root directory of different sites, then, my url rewriting also plays a role, but when I access it through my configured ServerName, that is, koma.com, instead of accessing a local site but accessing a site on the Internet, I don't know how to use my configured ServerName to access the local site? Please help ....

You can modify the hosts file in windows, but I don't know how to do it in linux ....


Reply to discussion (solution)

You can modify the hosts file in linux, but you can test it yourself.

However, this can only be mapped to the local machine. if you use linux to open a browser and enter koma.com, it is useless to enter it in local windows. do you need to do this? So you still need a domain name ,,,,

Where is the access? only the host machine configured with the host can access the server effectively.



DocumentRoot "E:/AppServ/www/web"
ServerName koma.com
ErrorLog "logs/error. log"

Http://www.baidu.com? Wd = linux + hosts
Modify hosts in linux

However, this can only be mapped to the local machine. if you use linux to open a browser and enter koma.com, it is useless to enter it in local windows. do you need to do this? So you still need a domain name ,,,,

Test on the local machine. if there is a public IP address, you do not need to modify the hosts file. it is much easier to configure the virtual server. However, if you test the local machine, you need to modify the hosts file, the key is that I will not modify the hosts file in linux or I cannot find it ....

Where is the access? only the host machine configured with the host can access the server effectively.


It is access from the local machine. I want to modify the hosts file in linux, but I cannot find it .....

Http://www.baidu.com? Wd = linux + hosts
Modify hosts in linux

You understand what I said, O (∩ _ ∩) O haha ~ That's what I mean, Thansk ~ I'll test it to see if it works.

In Linux, you can also configure hosts and directly add the corresponding ip address and virtual domain name to vi/etc/hosts.

Now, my virtual machine has been successfully configured with the information provided by everyone, but here is another problem: the second virtual machine I configured, when I enter in the browser: www.fanta.com automatically adds an index to the end. jsp is changed to www.fanta.com/index.jsp. The following is my configuration. I don't know where it is. please take a look .... Grateful ~~


In Linux, you can also configure hosts and directly add the corresponding ip address and virtual domain name to vi/etc/hosts.

Please take a look. O (∩ _ ∩) O thank you.

Http://www.baidu.com? Wd = linux + hosts
Modify hosts in linux

Where is the access? only the host machine configured with the host can access the server effectively.

However, this can only be mapped to the local machine. if you use linux to open a browser and enter koma.com, it is useless to enter it in local windows. do you need to do this? So you still need a domain name ,,,,

You can modify the hosts file in linux, but you can test it yourself.

Please take a look. O (∩ _ ∩) O thank you.

What is in the fanta directory? The index. jsp has all come out. it should be missing, or check the configuration again. I am not clear about the details.

Now, my virtual machine has been successfully configured with the information provided by everyone, but here is another problem: the second virtual machine I configured, when I enter in the browser: www.fanta.com automatically adds an index to the end. jsp is changed to www.fanta.com/index.jsp. The following is my configuration. I don't know where it is. please take a look .... Grateful ~~



There seems no problem with the two figures. you can see where the configuration file contains index. jsp and then solve it.

What is in the fanta directory? The index. jsp has all come out. it should be missing, or check the configuration again. I am not clear about the details.

The fanta Directory has only one test. php file .... I don't know either. it is reasonable to say that there is no problem. let's take a look.

What is in the fanta directory? The index. jsp has all come out. it should be missing, or check the configuration again. I am not clear about the details.


Now, my virtual machine has been successfully configured with the information provided by everyone, but here is another problem: the second virtual machine I configured, when I enter in the browser: www.fanta.com automatically adds an index to the end. jsp is changed to www.fanta.com/index.jsp. The following is my configuration. I don't know where it is. please take a look .... Grateful ~~



There seems no problem with the two figures. you can see where the configuration file contains index. jsp and then solve it.

Thank you for choosing to restart your computer today, restart apache, and clear the browser cache. after you refresh ctrl + f5, you will find that the problem is okay .... Okay, it should be a cache issue yesterday or an apache issue. yesterday I knew about the browser cache but I never restarted my computer... thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.