How to configure virtual machines in Apache server, Apache virtual machine _php Tutorial

Source: Internet
Author: User

How to configure virtual machines in Apache server, Apache virtual machine


Sina Weibo virtual machine development configuration steps and introduction.
1, because the back of the virtual machine need to use rewrite, so first edit the Apache conf directory under the httpd.conf file. (Can be operated according to actual needs)
Add mod_rewrite.so module support. Remove the # number in front of the following line.
LoadModule Rewrite_module modules/mod_rewrite.so
2. Configure Apache to support virtual machines. This step is important.
# Virtual Hosts
#Include conf/extra/httpd-vhosts.conf
Find the relevant text above and remove the # # # before # # conf/extra/httpd-vhosts.conf.
# Virtual Hosts
Include conf/extra/httpd-vhosts.conf
Save exit.
3. Edit the httpd-vhosts.conf under the Extra folder in the Conf directory.
Remove the instance configuration and add a new configuration. In the case of Sina Weibo, the configuration file is as follows:
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine your can setup VirtualHost containers for them. Most configurations
# Use of name-based virtual hosts so the server doesn ' t need to worry about
# IP addresses. This was indicated by the asterisks in the directives below.
#
# documentation at
#
# for further details before your try to setup virtual hosts.
#
# The command line option '-s ' to verify your virtual host
# configuration.
#
# use name-based virtual hosting.
#
Namevirtualhost *:80
#
# VirtualHost Example:
# Almost any Apache directive could go into a VirtualHost container.
# The first VirtualHost section was used for all requests and that does not
# match a ServerName or Serveralias in any Block.
#

#管理员邮箱
ServerAdmin jiangfeng3@staff.sina.com.cn
#项目根目录
DocumentRoot "D:/htdocs/frame_export"
#域名
ServerName test.t.sina.com.cn
#别名
Serveralias test.t.sina.com.cn
#错误日志路径
Errorlog "Logs/test.t.sins.com.cn-error.log"
Customlog "Logs/test.t.sins.com.cn-access.log" common
Rewriteengine on
#重写规则, can be added according to the actual needs
Rewriterule ^/(. *) $/apps/index.php [L]

4. Edit the local host file, take windows as an example
Enter C:/WINDOWS/SYSTEM32/DRIVERS/ETC
Notepad opens the Hosts file
Last Added
127.0.0.1 localhost
127.0.0.1 test.t.sina.com.cn
Example:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This was a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings for IP addresses to host names. each
# entry should is kept on a individual line. The IP address should
# is placed in the first column followed by the corresponding host name.
# The IP address and the host name should is separated by at least one
# space.
#
# Additionally, comments (such as these) may is inserted on individual
# lines or following the machine name denoted by a ' # ' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source Server
# 38.25.63.10 x.acme.com # x client Host
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
#:: 1 localhost
127.0.0.1 test.t.sina.com.cn
Save exit
5. Restart Apache, browser input http://test.t.sina.com.cn

Reprint please specify the original address: http://www.server110.com/apache/201309/1615.html

http://www.bkjia.com/PHPjc/1119057.html www.bkjia.com true http://www.bkjia.com/PHPjc/1119057.html techarticle Apache Server configuration virtual machine method, Apache virtual machine Sina Weibo virtual machine development configuration steps and introduction. 1, because the back of the virtual machine need to use rewrite, so first edit Apach ...

  • 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.