How to develop a website using Apache to simulate an Internet Environment

Source: Internet
Author: User

Because manyProgramDuring development, developers will create a folder under the website directory specified by Apache to put the website. When testing on the local machine, they enter http: // 127.0.0.1/web1/to access the website, however, the domain name is used after the website is uploaded, which may cause incorrect paths.
Solution:
Find the hosts file in the c: \ windows \ system32 \ drivers \ etc directory, open it in text, and add a sentence in it
127.0.0.1 emtit.com
In this way, you can use www.emtit.com to access your website without a DNS server, but it cannot reach your virtual directory and open httpd of Apache. in the conf configuration file, add the followingCode

Copy codeThe Code is as follows: namevirtualhost *: 80
<Virtualhost *: 80>
Serveradmin hjwtp2005@163.com
DocumentRoot/flashgame
Servername emtit.com
Serveralias www.emtit.com
Errorlog @ rel_logfiledir @/dummy-host.example.com-error_log
Customlog @ rel_logfiledir @/dummy-host.example.com-access_log common
</Virtualhost>

In this way, you can access the local website just like accessing the Internet without DNS.

Related Article

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.