apache configuration multi-site, apache configuration site_PHP tutorial

WBOY
Release: 2016-07-13 09:53:12
Original
964 people have browsed it

apache configures multi-site, apache configures site

In the httpd.conf file, there is the following configuration (note: omit the comment content of the httpd.conf file)

Listen 80
ServerName localhost
<Directory />
    AllowOverride none
    Require all denied
</Directory>


DocumentRoot "E:"
<Directory "E:/Workshop/Apache">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
Copy after login



(It is best to clear the browser cache before testing), then enter http://localhost/Workshop/Apache/ in the browser to access all files under E:/Workshop/Apache , note that the root directory here is E:, but the above Directory has set permissions so it cannot access all the contents under the E drive. If the above Directory is changed to:


<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
Copy after login



Then you can access everything in the E drive from the browser. When you enter localhost in the browser, the browser will display all the content in the root directory of the E drive and can access it. . For security reasons, we usually don’t do this, so the usual setting method is the following configuration:


Listen 80
ServerName localhost
<Directory />
    AllowOverride none
    Require all denied
</Directory>


DocumentRoot "E:/Workshop/Apache"
<Directory "E:/Workshop/Apache">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
Copy after login



Only allow access to a specific directory through the browser, which is all the content under the E:/Workshop/Apache directory. Of course, for the second Dir, you can set the access permissions for different folders under E:/Workshop/Apache.


Finally, let’s talk about the settings of the virtual host. Please set it in the following format (just put it at the end of the httpd.conf file):


As shown below, you need to set it first Listening port, then NameVirtualHost specifies the host address and port. The next step is to set up VirtualHost, including SeverName, which is the host name and document root directory. Note that for local development, set ServerName to localhost or 127.0.0.1. , the document root directory can be the same as the directory settings, or you can set different access permissions for different folders in the document root directory. The × sign represents the virtual host that listens to all access settings ports.

Listen 81
NameVirtualHost *:81
<VirtualHost *:81>
    ServerName 127.0.0.1
    DocumentRoot "C:/Users/Administrator/php/webroot1"
    <Directory "C:/Users/Administrator/php/webroot1">
   Options Indexes FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>
</VirtualHost>


Listen 82
NameVirtualHost ×:82
<VirtualHost *:82>
    ServerName 127.0.0.1
    DocumentRoot "C:/Users/Administrator/php/webroot2"
    <Directory "C:/Users/Administrator/php/webroot2">
   Options Indexes FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>
</VirtualHost>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1004399.htmlTechArticleapache configuration multi-site, the apache configuration site is in the httpd.conf file, there is the following configuration (note: omit httpd .conf file) Listen 80ServerName localhostDirectory / AllowO...
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