Apache and virtual directory configuration in Windows environment

  
                  

Summary

---------- This article provides a very brief introduction to how to install Apache2.2.x on a Windows platform and configure a virtual directory. As a reference for quick installation. The best documentation for setting up is the official documentation. See the link below. Careful review of the documentation during installation and configuration is a good solution. 1. Apache HTTP Server Version 2.2 English documentation 2. Apache HTTP Server Version 2.2 Chinese documentation ---------- Preparation conditions ---------- Go to http://httpd.apache.org/to download the corresponding version of Apache. (Note: 2.0 and 2.2 versions of Apache correspond to Module version pages are different and incompatible with each other, so you need to download the corresponding version of Apache according to the application. If you do not need to use ssl, you need to download Apache 2.xx-win32-x86-no_ssl.msi, if you need to use it, you need Download Apache 2.xx-win32-x86-openssl-xxxmsi ---------- Installation ---------- Double-click the installer, which will guide you through the installation process. Make sure you enter the correct server URL (if your server does not have a DNS name, you can enter the IP address directly). It is recommended to install Apache as " for all Users, on Port 80, as a service" Apache will automatically install a system service to start automatically. Note: If you already have an IIS or other program that uses port 80, the installation may fail. If so, you can find the file httpd.conf in the Apache Group\\Apache2\\conf directory of the program directory, and change the Listen 80 to a different port, such as Listen 81. Then re-run the installer, this time there should be no more problems. After the installation is complete, type http://loccalhost into your browser. If you have a configured website, Apache will install successfully.

If you install Apache as a service, it will run as a local system account. It would be safer to create a separate user for Apache to run it. Open the Apache installation directory, find the file /conf/httpd.conf, open it for configuration editing. The configuration file has a detailed description of each item. After the configuration is finished, you can run the Apache installation folder in the start menu. Test Configuration tool to verify that the configuration file is correct. If the configuration is incorrect, it will give a brief description. If you pass the Test Configuration tool after the configuration is finished, but still can't run Apache smoothly, you can go to [Apache installation directory]/logs/View the records in this directory to find out where the problem lies. ---------- Configure the httpd.conf file ---------- # Set the document home directory, followed by the disk directory DocumentRoot "D:/Programs/Apache2.2/htdocs" # Add a virtual directory, the following settings to access the server's "D:/Programs/WebPath" directory when entering http://localhost/webpath/in the browser Alias ​​/webpath/"D:/Programs/WebPath" # When /webPath is not followed by "/", you can enter http://localhost/webpa in the browser. Th Apache will automatically add "/" Alias ​​/webpath "D:/Programs/WebPath" # URL redirect Redirect permanent /foo/http://www.example.com/bar/# to set virtual Host: Please refer to http://lamp.linux.gov.cn/Apache/ApacheMenu/vhosts/index.html

Copyright © Windows knowledge All Rights Reserved