Table of Contents
apache configures multi-site, apache configures site
Home Backend Development PHP Tutorial apache configuration multi-site, apache configuration site_PHP tutorial

apache configuration multi-site, apache configuration site_PHP tutorial

Jul 13, 2016 am 09:53 AM
apache

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run the h5 project How to run the h5 project Apr 06, 2025 pm 12:21 PM

Running the H5 project requires the following steps: installing necessary tools such as web server, Node.js, development tools, etc. Build a development environment, create project folders, initialize projects, and write code. Start the development server and run the command using the command line. Preview the project in your browser and enter the development server URL. Publish projects, optimize code, deploy projects, and set up web server configuration.

How to set character encoding on the server side to solve Bootstrap Table garbled How to set character encoding on the server side to solve Bootstrap Table garbled Apr 07, 2025 pm 12:00 PM

To set character encoding on the server side to solve the garbled Bootstrap Table, you need to follow the following steps: check the server character encoding; edit the server configuration file; set the character encoding to UTF-8; save and restart the server; verify the encoding.

How to start apache How to start apache Apr 13, 2025 pm 01:06 PM

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

How to check Debian OpenSSL configuration How to check Debian OpenSSL configuration Apr 12, 2025 pm 11:57 PM

This article introduces several methods to check the OpenSSL configuration of the Debian system to help you quickly grasp the security status of the system. 1. Confirm the OpenSSL version First, verify whether OpenSSL has been installed and version information. Enter the following command in the terminal: If opensslversion is not installed, the system will prompt an error. 2. View the configuration file. The main configuration file of OpenSSL is usually located in /etc/ssl/openssl.cnf. You can use a text editor (such as nano) to view: sudonano/etc/ssl/openssl.cnf This file contains important configuration information such as key, certificate path, and encryption algorithm. 3. Utilize OPE

How to use Debian Apache logs to improve website performance How to use Debian Apache logs to improve website performance Apr 12, 2025 pm 11:36 PM

This article will explain how to improve website performance by analyzing Apache logs under the Debian system. 1. Log Analysis Basics Apache log records the detailed information of all HTTP requests, including IP address, timestamp, request URL, HTTP method and response code. In Debian systems, these logs are usually located in the /var/log/apache2/access.log and /var/log/apache2/error.log directories. Understanding the log structure is the first step in effective analysis. 2. Log analysis tool You can use a variety of tools to analyze Apache logs: Command line tools: grep, awk, sed and other command line tools.

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

See all articles