Apache服务器配置全攻略(八)_PHP
Apache
用于设置访问控制的设置主要是针对目录和文件进行设置的,然而也可以针对不同的URL进行访问控制的设置,这样就不必担心ScriptAlias、Alias是否将路径设置到了受控制的目录之外了。针对URL进行控制的语句为 Location语句,这样不但能对服务器上的文件、CGI提供保护,此外,它还能保护不能找到对应文件,而是由服务器本身提供的特殊功能URL。http://servername/server-status用于报告当前Apache服务器的状态,http://servername/server-info用于报告Apache 服务器的统计信息。与此相关的设置还有ExtendedStatus参数,可以让服务器输出更详细的的报告。#
#ProxyRequests On
#
#
# Order deny,allow
# Deny from all
# Allow from .your_domain.com
#
#ProxyVia On
#CacheRoot "/www/proxy"
#CacheSize 5
#CacheGcInterval 4
#CacheMaxExpire 24
#CacheLastModifiedFactor 0.1
#CacheDefaultExpire 1
#NoCache a_domain.com another_domain.edu joes.garage_sale.com
#
Apache服务器本身就具备代理的功能,然而这要求加载入mod_proxy模块。这能使用IfModule语句进行判断,如果存在mod_proxy模块,就使用ProxyRequests打开代理支持。此后的Directory用于设置对Proxy功能的访问权限设置,以及用于设置缓冲的各个参数设置。
虚拟主机
#NameVirtualHost 12.34.56.78:80
#NameVirtualHost 12.34.56.78
#
# ServerAdmin webmaster@host.some_domain.com
# DocumentRoot /www/docs/host.some_domain.com
# ServerName host.some_domain.com
# ErrorLog logs/host.some_domain.com-error_log
# CustomLog logs/host.some_domain.com-access_log common
#
#
缺省设置文件中的这些内容是用于设置命名基础的虚拟主机服务器时使用。
其中NameVirtualHost 来指定虚拟主机使用的IP地址,这个IP地址将对应多个 DNS名字,如果Apache使用了Listen 参数控制了多个端口,那么就可以在这里加上端口号以进一步进行区分对不同端口的不同连接请求。此后,使用 VirtualHost 语句,使用NameVirtualHost指定的IP地址作参数,对每个名字都定义对应的虚拟主机设置。
虚拟主机是在一台Web服务器上,可以为多个单独域名提供Web服务,并且每个域名都完全独立,包括具有完全独立的文档目录结构及设置,这样域名之间完全独立,不但使用每个域名访问到的内容完全独立,并且使用另一个域名无法访
问其他域名提供的网页内容。
虚拟主机的概念对于ISP来讲非常有用,因为虽然一个组织可以将自己的网页挂在具备其他域名的服务器上的下级往址上,但使用独立的域名和根网址更为正式,易为众人接受。传统上,必须自己设立一台服务器才能达到单独域名的目的,然而这需要维护一个单独的服务器,很多小单位缺乏足够的维护能力,更为合适的方式是租用别人维护的服务器。ISP也没有必要为一个机构提供一个单独的服务器,完全可以使用虚拟主机能力,使服务器为多个域名提供Web服务,而且不同的服务互不干扰,对外就表现为多个不同的服务器。
有两种设定虚拟主机的方式,一种是基于HTTP 1.0标准,需要一个具备多IP
地址的服务器,再配置DNS 服务器,给每个IP地址以不同的域名,最后才能配置Apache的配置文件,使服务器对不同域名返回不同的Web文档。由于这需要使用额外的IP地址,对每个要提供服务的域名都要使用单独的IP地址,因此这种方式实现起来问题较多。
可以在一个网络界面上绑定多个IP地址,Linux下需要使用ifconfig的 alias参数来进行这个配置,但此时会影响网络性能。
HTTP 1.1标准在协议中规定了对浏览器和服务器通信时,服务器能够跟踪浏
览器请求的是哪个主机名字。因此可以利用这个新特性,使用更轻松的方式设定
虚拟主机。这种方式不需要额外的IP地址,但需要新版本的浏览器支持。这种方式已经成为建立虚拟主机的标准方式。
要建立非IP基础的虚拟主机,多个域名是不可少的配置,因为每个域名就对
应一个要服务的虚拟主机。因此需要更改DNS服务器的配置,为服务器增加多个C NAME选项,如:
linux IN A 192.168.1.64
vhost1 IN CNAME linux
vhost2 IN CNAME linux
基本的设置选项都是为了linux主机设定的,如果要为vhost1和vhost2设定
虚拟主机,就要使用VirtualHost语句定义不同的选项,在语句中可以使用配置文件前面中的大部分选项,而可以重新定义几乎所有的针对服务器的设置。
NameVirtualHost 192.168.1.64
DocumentRoot /www/data
ServerName linux.example.org.cn
DocumentRoot /vhost1
ServerName vhost1.example.org.cn
DocumentRoot /vhost2
ServerName vhost2.example.org.cn
这里需要注意的是,VirtualHost的参数地址一定要和NameVirtualHost定义的地址相一致,必须保证所有的值严格一致,Apache服务器才承认这些定义是为这个IP地址定义的虚拟主机。
此外,定义过NameVirtualHost之后,那么对这个IP地址的访问都被区分不同的虚拟主机进行处理,而对其他IP地址的访问,例如127.0.0.1,才应用前面定义的缺省选项。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Publishing works on Douyin can attract more attention and likes, but sometimes it may be difficult for us to publish works in real time. In this case, we can use Douyin's scheduled release function. Douyin’s scheduled release function allows users to automatically publish works at a scheduled time, which can better plan the release plan and increase the exposure and influence of the work. 1. How to set the scheduled time for publishing works on Douyin? To set a scheduled release time, first go to Douyin's personal homepage, find the "+" button in the upper right corner, and click to enter the release page. There is a clock icon in the lower right corner of the publishing page. Click to enter the scheduled publishing interface. In the interface, you can choose the type of work you want to publish, including short videos, long videos, and live broadcasts. Next, you need to set a time for your work to be published. TikTok provides

NetEase Mailbox, as an email address widely used by Chinese netizens, has always won the trust of users with its stable and efficient services. NetEase Mailbox Master is an email software specially created for mobile phone users. It greatly simplifies the process of sending and receiving emails and makes our email processing more convenient. So how to use NetEase Mailbox Master, and what specific functions it has. Below, the editor of this site will give you a detailed introduction, hoping to help you! First, you can search and download the NetEase Mailbox Master app in the mobile app store. Search for "NetEase Mailbox Master" in App Store or Baidu Mobile Assistant, and then follow the prompts to install it. After the download and installation is completed, we open the NetEase email account and log in. The login interface is as shown below

Cloud storage has become an indispensable part of our daily life and work nowadays. As one of the leading cloud storage services in China, Baidu Netdisk has won the favor of a large number of users with its powerful storage functions, efficient transmission speed and convenient operation experience. And whether you want to back up important files, share information, watch videos online, or listen to music, Baidu Cloud Disk can meet your needs. However, many users may not understand the specific use method of Baidu Netdisk app, so this tutorial will introduce in detail how to use Baidu Netdisk app. Users who are still confused can follow this article to learn more. ! How to use Baidu Cloud Network Disk: 1. Installation First, when downloading and installing Baidu Cloud software, please select the custom installation option.

MetaMask (also called Little Fox Wallet in Chinese) is a free and well-received encryption wallet software. Currently, BTCC supports binding to the MetaMask wallet. After binding, you can use the MetaMask wallet to quickly log in, store value, buy coins, etc., and you can also get 20 USDT trial bonus for the first time binding. In the BTCCMetaMask wallet tutorial, we will introduce in detail how to register and use MetaMask, and how to bind and use the Little Fox wallet in BTCC. What is MetaMask wallet? With over 30 million users, MetaMask Little Fox Wallet is one of the most popular cryptocurrency wallets today. It is free to use and can be installed on the network as an extension

As one of the most popular short video platforms in the world, Douyin allows everyone to become a creator and share every moment of life. For Douyin users, tags are a very important function. It can help users better classify and retrieve content, and also allows the platform to push appropriate content to users more accurately. So, where are the Douyin tags set? This article will explain in detail how to set up and use tags on Douyin. 1. Where is the Douyin tag set? Using tags on Douyin can help users better classify and label their works, making it easier for other users to find and follow them. The method to set the label is as follows: 1. Open the Douyin APP and log in to your account. 2. Click the "+" sign at the bottom of the screen and select the "Publish" button. 3.

1. Open the Weibo client, click the three little dots on the editing page, and then click Scheduled Post. 2. After clicking on scheduled posting, there will be a time option on the right side of the publishing time. Set the time, edit the article, and click on the yellow words in the lower right corner to schedule posting. 3. The mobile version of Weibo does not currently support scheduled publishing. This function can only be used on the PC client!

Even answering calls in Do Not Disturb mode can be a very annoying experience. As the name suggests, Do Not Disturb mode turns off all incoming call notifications and alerts from emails, messages, etc. You can follow these solution sets to fix it. Fix 1 – Enable Focus Mode Enable focus mode on your phone. Step 1 – Swipe down from the top to access Control Center. Step 2 – Next, enable “Focus Mode” on your phone. Focus Mode enables Do Not Disturb mode on your phone. It won't cause any incoming call alerts to appear on your phone. Fix 2 – Change Focus Mode Settings If there are some issues in the focus mode settings, you should fix them. Step 1 – Open your iPhone settings window. Step 2 – Next, turn on the Focus mode settings

When buying tickets on Damai.com, in order to ensure that the ticket purchase time can be accurately grasped, users can set a floating clock to grab tickets. The detailed setting method is below, let us learn together. How to bind the floating clock to Damai 1. Click to open the floating clock app on your phone to enter the interface, and click on the location where the flash sale check is set, as shown in the figure below: 2. After coming to the page of adding new records, click on Damai.com Copy the ticket purchase link page copied in. 3. Next, set the flash sale time and notification time below, turn on the switch button behind [Save to Calendar], and click [Save] below. 4. Click to turn on [Countdown], as shown in the figure below: 5. When the reminder time comes, click the [Start Picture-in-Picture] button below. 6. When the ticket purchase time comes
