How to configure virtual machines in Apache server apache manual apache tutorial apache log

WBOY
Release: 2016-07-29 08:53:52
Original
1071 people have browsed it

Sina Weibo virtual machine development and configuration steps and introduction.
1. Since Rewrite will be used in the virtual machine later, edit the httpd.conf file in Apache's conf directory first. (Can be operated according to actual needs)
Add mod_rewrite.so module support. Remove the # sign in front of the following lines.
LoadModule rewrite_module modules/mod_rewrite.so
2. Configure apache to support virtual machines. This step is very important.
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
Find the relevant text above and remove the # before #Include conf/extra/httpd-vhosts.conf.
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Save and exit.
3. Edit httpd-vhosts.conf in the extra folder in the conf directory.
Remove the instance configuration and add new configuration. Taking Sina Weibo as an example, the configuration file is as follows:
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name -based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
#
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias ​​in any block.
#

  #Administrator’s email
  ServerAdmin jiangfeng3@staff.sina.com.cn
  #Project root directory  
  DocumentRoot "D:/htdocs/frame_export"
#domain name
serverName test.t.sina.com.cn
#aliases
serverias test.sina.com.cn
#ErrorLog "logs/test.t. sins.com.cn-error.log"
CustomLog "logs/test.t.sins.com.cn-access.log" common
RewriteEngine on
#Rewrite rules, you can add them according to actual needs
RewriteRule ^/(. *)$ /apps/index.php [L]

4. Edit the local host file, taking windows as an example
Enter C:/Windows/System32/drivers/etc
Open the hosts file with notepad
Finally Add
127.0.0.1 localhost 127.0.0.1 test.t.sina.com.cn
Example:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be 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 and exit
5. Restart apache and enter http://test.t.sina.com.cn in the browser

Please indicate the original address when reprinting: http://www.server110.com/apache/201309/1615.html

The above introduces the method of configuring virtual machines in the Apache server, including Apache content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!