Apache Configuration and virtual host settings in Windows

Source: Internet
Author: User

Download apache:http://httpd.apache.org/download.cgi

Install step skip ....

After the Apache program is installed, the Monitor Apache servers does not start and the icon appears as a red stop flag. Mouse to the taskbar the Apache service icon displays "No Services installed" for the following reasons:

Apache Service not installed successfully

If the Apache service program is successfully installed, then we can right-click on "My Computer"-"admin"-"service and Application"-"services" to see the presence of Apache services in the right-hand list, if not present, indicating that the server was not successfully installed. Specific solutions are as follows:

1 operation type: CMD into the DOS operation interface;
2 Enter the Apache installation directory:


CD C:/Program Files/apache Software foundation/apache2.2/bin
3) Type the command:


Httpd.exe-k Install-n apache2
Add Apache as a service, in some versions of Apache2

Apache.exe-k install-n apache2.
4) Start the service. Type command: net start apache2.

If Apache can not start, the httpd.conf file ServerName remove the # annotation, modify the original host name is localhost, 80 ports such as occupied, use NETSTAT-ANB to detect the occupation of the process, terminate the relevant process of the program, or change a port number.

Combine PHP with Apache in module mode to make PHP into Apache

Open httpd.conf and add the following five elements:

LoadModule Php5_module C:/php/php5apache2_2.dll
LoadFile C:/php/libeay32.dll
LoadFile C:/php/ssleay32.dll
Phpinidir the directory of the "c:/php" #php. ini file
AddType application/x-httpd-php. php
Found it
DirectoryIndex index.html
To
DirectoryIndex index.php index.html
———————————————————
The following way is more neat, the effect is ditto

Found it:
#LoadModule Vhost_alias_module modules/mod_vhost_alias.so
Add a row later
LoadModule Php5_module C:/php/php5apache2_2.dll
LoadFile C:/php/libeay32.dll
LoadFile C:/php/ssleay32.dll
Phpinidir "c:/php"

Found it:
AddType application/x-gzip. GZ tgz
Add a row later
AddType application/x-httpd-php. php
AddType application/x-httpd-php. html #加入此行则. html files can also execute PHP programs
Libeay32.dll and Ssleay32.dll These two files are php.ini in case the Extension=php_curl.dll extensions are enabled in the file, and if this extension is not turned on, you can delete two lines of code that call two files.

========================================================================
To add a virtual host:

Found it
ServerAdmin
Put the "#" (without double quotes) in front, which means the annotation is dropped.

Found it


DocumentRoot "DocumentRoot" C:/Program files/apache Software Foundation/apache2.2/htdocs "
This is your location to install Apache, you should know to put this paragraph also hit "#", commented out.

If each site in the virtual space is in the wwwroot directory of D disk, add this section

<directory "D:/wwwroot" >
Options Indexes FollowSymLinks
AllowOverride All
Order Allow,deny
Allow from all
</Directory>
This is very important, next, the various sites are placed in the Wwwroot directory, to normal access.

Found it


#Include conf/extra/httpd-vhosts.conf
Remove the previous # annotation to make it effective

Then you can go to the extra directory, set up the httpd-vhosts.conf, add the site
Examples are as follows:

<virtualhost *:80>
ServerAdmin webmaster@ domain name. com
DocumentRoot "d:/wwwroot/domain name. com/www"
ServerName domain name. com
Serveralias www. domain name. com
ErrorLog "d:/wwwroot/domain name. com/logs/domain name. Com-error.log"
Customlog "d:/wwwroot/domain name. com/logs/domain name. Com-access.log" Common
</VirtualHost>
</Directory>
If you want to establish a virtual directory (file map) for the site, add the following in the <virtualhost *:80></virtualhost> tab:

Alias/uploads "d:/wwwroot/domain name. Com/www/wp-content/uploads"
<directory "d:/wwwroot/domain name. com/www/wp-content/uploads" >
Order Allow,deny
Allow from all
</Directory>


Through virtual directories (file mappings), regular expressions:

http://www. Domain name. com/wp-content/uploads/

Access is available through the following aliases:

http://www. Domain name. com/uploads/

If you need to use the HTML static functionality of rewrite,
In the httpd.conf file, please find
#LoadModule Rewrite_module modules/mod_rewrite.so

Remove the front # annotation to make the mod_rewrite.so module effective

and put all the
AllowOverride None

Change to
AllowOverride All

Okay, everything's OK, don't forget REStat Apache

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.