`
wangguorui89
  • 浏览: 320257 次
  • 性别: Icon_minigender_1
  • 来自: 山西
社区版块
存档分类
最新评论

Linux Apache 安装、配置手稿

阅读更多
原方地址:http://www.kreny.com/computer/linux/apache.html
Apache 1.3.33 和 PHP 4.3.10 的动态模块和静态编译
安装 Apache 2.0.48 (草稿)
配置 Apache 2.0.48 (草稿)
使用 mod_limitipconn.c 来限制 apache 的并发数
定制 Apache index 目录
让apache上的图片有防止盗链的功能
资料: Unix 下的 Apache 中安装 PHP 的详细资料 (转自《PHP手册》)
Apache 1.3.33 和 PHP 4.3.10 的动态模块编译和静态编译
以下是 PHP 4 的 Apache 共享模块版本安装过程。
安装流程为 [编译安装 apache 1.3.33] ---> [编译安装 PHP 4.3.10] ---> [在 httpd.conf 中以模块形式调用 PHP](加入以下语句) : AddType application/x-httpd-php .php
LoadModule php4_module libexec/libphp4.so

安装过程: # wget http://jp2.php.net/get/php-4.3.10.tar.gz/from/this/mirror
# wget http://sunsite.tus.ac.jp/pub/apache/httpd/apache_1.3.33.tar.gz
# tar -zxvf php-4.3.10.tar.gz
# tar -zxvf apache_1.3.33.tar.gz
# ls -l

Total 8340
   drwxr-xr-x 8 mysql games 4096 10 28 01:47 apache_1.3.33
   drwxr-xr-x 14 1003 1003 4096 12 15 02:55 php-4.3.10# cd apache_1.3.33
# ./configure --prefix=/usr/local/apache --enable-module=so \
--enable-module=rewrite --enable-module=speling

Configuring for Apache, Version 1.3.33
  + using installation path layout: Apache (config.layout)
  Creating Makefile
  Creating Configuration.apaci in src
  Creating Makefile in src
  + configured for Linux platform
  + setting C compiler to gcc
  + setting C pre-processor to gcc -E
  + using "tr [a-z] [A-Z]" to uppercase
  + checking for system header files
  + adding selected modules
  o rewrite_module uses ConfigStart/End
  + using -ldb1 for DBM support
  enabling DBM support for mod_rewrite
  + using system Expat
  + using -ldl for vendor DSO support
  + checking sizeof various data types
  + doing sanity check on compiler and options
  Creating Makefile in src/support
  Creating Makefile in src/regex
  Creating Makefile in src/os/unix
  Creating Makefile in src/ap
  Creating Makefile in src/main
  Creating Makefile in src/modules/standard# make
# make install

   +--------------------------------------------------------+
   | You now have successfully built and installed the      |
   | Apache 1.3 HTTP server. To verify that Apache actually |
   | works correctly you now should first check the         |
   | (initially created or preserved) configuration files   |
   |                                                        |
   | /usr/local/apache/conf/httpd.conf                      |
   | and then you should be able to immediately fire up     |
   | Apache the first time by running:                      |
   |                                                        |
   | /usr/local/apache/bin/apachectl start                  |
   |                                                        |
   | Thanks for using Apache. The Apache Group              |
   | http://www.apache.org/                                 |
   +--------------------------------------------------------+# cd ../php-4.3.10
#./configure --with-mysql=/usr/local/mysql \
--with-apxs=/usr/local/apache/bin/apxs\
--with-zlib-dir --enable-mbstring=all
# make
# make install

   Installing PHP SAPI module: apache
   [activating module `php4' in /usr/local/apache/conf/httpd.conf]
   cp libs/libphp4.so /usr/local/apache/libexec/libphp4.so
   chmod 755 /usr/local/apache/libexec/libphp4.so
   cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak
   cp /usr/local/apache/conf/httpd.conf.new /usr/local/apache/conf/httpd.conf
   rm /usr/local/apache/conf/httpd.conf.new
   Installing PHP CLI binary: /usr/local/bin/
   Installing PHP CLI man page: /usr/local/man/man1/
   Installing PEAR environment: /usr/local/lib/php/
   [PEAR] Archive_Tar - installed: 1.1
   [PEAR] Console_Getopt - installed: 1.2
   [PEAR] PEAR - installed: 1.3.2
   Wrote PEAR system config file at: /usr/local/etc/pear.conf
   You may want to add: /usr/local/lib/php to your php.ini include_path
   [PEAR] DB - installed: 1.6.2
   [PEAR] HTTP - installed: 1.2.2
   [PEAR] Mail - installed: 1.1.3
   [PEAR] Net_SMTP - installed: 1.2.6
   [PEAR] Net_Socket - installed: 1.0.1
   [PEAR] XML_Parser - installed: 1.0.1
   [PEAR] XML_RPC - installed: 1.1.0
   Installing build environment: /usr/local/lib/php/build/
   Installing header files: /usr/local/include/php/
   Installing helper programs: /usr/local/bin/
   program: phpize
   program: php-config
   program: phpextdist# cp php.ini-dist /usr/local/lib/php.ini
# echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local
# echo "/usr/local/mysql/support-files/mysql.server start" >> /etc/rc.d/rc.local

// MyChanges in php.ini
short_open_tag = Off
output_buffering = On
zlib.output_compression = On
safe_mode = On


以下安装将静态编译 php 到 apache 中去。
安装流程为:
[Configure apache 1.3.33] --> [编译安装 PHP 4.3.10] ---> [Reconfigure 编译安装 apache 1.3.33] --> [修改 httpd.conf] 这个配置将生成 libmodphp4.a 库,mod_php4.c 和一些相关的文件并且拷贝到 Apache 源程序目录中的 src/modules/php4 目录下。然后用 --activate-module=src/modules/php4/libphp4.a 编译 Apache,Apache 编译系统会生成 libphp4.a 并且将其静态地连接到 httpd 程序中。PostgreSQL 支持也直接包括在这个 httpd 程序中了,因此最终结果是单一的一个包括了所有 Apache 和 PHP 支持的 httpd 可执行文件。
     --《PHP手册》--

从错误信息中总结出以上安装过程:
在配置 apache 之前如果首先配置 php 会有以下错误结果:
     configure: error: Please run Apache\'s configure or src/Configure program once and try again
因此,首先要将 apache 的 source configure 一下。


安装过程: # wget http://jp2.php.net/get/php-4.3.10.tar.gz/from/this/mirror
# wget http://sunsite.tus.ac.jp/pub/apache/httpd/apache_1.3.33.tar.gz
# tar -zxvf php-4.3.10.tar.gz
# tar -zxvf apache_1.3.33.tar.gz
# ls -l

Total 8340
   drwxr-xr-x 8 mysql games 4096 10 28 01:47 apache_1.3.33
   drwxr-xr-x 14 1003 1003 4096 12 15 02:55 php-4.3.10# cd ./apache_1.3.33
# ./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite --enable-module=speling

Configuring for Apache, Version 1.3.33
  + using installation path layout: Apache (config.layout)
  Creating Makefile
  Creating Configuration.apaci in src
  Creating Makefile in src
  + configured for Linux platform
  + setting C compiler to gcc
  + setting C pre-processor to gcc -E
  + using "tr [a-z] [A-Z]" to uppercase
  + checking for system header files
  + adding selected modules
  o rewrite_module uses ConfigStart/End
  + using -lgdbm for DBM support
  enabling DBM support for mod_rewrite
  + using system Expat
  + using -ldl for vendor DSO support
  + checking sizeof various data types
  + doing sanity check on compiler and options
  Creating Makefile in src/support
  Creating Makefile in src/regex
  Creating Makefile in src/os/unix
  Creating Makefile in src/ap
  Creating Makefile in src/main
  Creating Makefile in src/modules/standard# cd ../php-4.3.10
#./configure --with-mysql=/usr/local/mysql --with-apache=/usr/src/apache_1.3.33 --with-zlib-dir --enable-mbstring=all

Generating files
updating cache ./config.cache
creating ./config.status
creating php4.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/php-config
creating sapi/apache/libphp4.module
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+
| *** NOTE ***                                                       |
| The default for register_globals is now OFF!                       |
|                                                                    |
| If your application relies on register_globals being ON, you       |
| should explicitly set it to on in your php.ini file.               |
| Note that you are strongly encouraged to read                      |
| http://www.php.net/manual/en/security.globals.php                  |
| about the implications of having register_globals set to on, and   |
| avoid using it if possible.                                        |
+--------------------------------------------------------------------+
Thank you for using PHP.# make

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).# make install

Installing PHP SAPI module: apache
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/man/man1/
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Archive_Tar - already installed: 1.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.3.2
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
[PEAR] DB - already installed: 1.6.2
[PEAR] HTTP - already installed: 1.2.2
[PEAR] Mail - already installed: 1.1.3
Optional dependencies:
package `Auth_SASL' is recommended to utilize some features.
[PEAR] Net_SMTP - upgraded: 1.2.6
[PEAR] Net_Socket - already installed: 1.0.1
[PEAR] XML_Parser - already installed: 1.0.1
[PEAR] XML_RPC - already installed: 1.1.0
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
  program: phpize
  program: php-config
  program: phpextdist# ls ../apache_1.3.33/src/modules/php4/ -l

total 12076
-rw-r--r-- 1 root root 12184108 May 9 17:39 libmodphp4.a
-rw-r--r-- 1 root root 712 May 9 17:39 libphp4.module
-rw-r--r-- 1 root root 252 May 9 17:39 Makefile.libdir
-rw-r--r-- 1 root root 2319 May 9 17:39 Makefile.tmpl
-rw-r--r-- 1 root root 26224 May 9 17:39 mod_php4.c
-rw-r--r-- 1 root root 12 May 9 17:39 mod_php4.exp
-rw-r--r-- 1 root root 1859 May 9 17:39 mod_php4.h
-rw-r--r-- 1 root root 1 May 9 17:39 mod_php4.lo
-rw-r--r-- 1 root root 104648 May 9 17:39 mod_php4.o# cd ../apache_1.3.33/
# ./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite --enable-module=speling --activate-module=src/modules/php4/libphp4.a

Configuring for Apache, Version 1.3.33
  + using installation path layout: Apache (config.layout)
  + activated php4 module (modules/php4/libphp4.a)
  Creating Makefile
  Creating Configuration.apaci in src
  Creating Makefile in src
  + configured for Linux platform
  + setting C compiler to gcc
  + setting C pre-processor to gcc -E
  + using "tr [a-z] [A-Z]" to uppercase
  + checking for system header files
  + adding selected modules
  o rewrite_module uses ConfigStart/End
  + using -lgdbm for DBM support
  enabling DBM support for mod_rewrite
  o php4_module uses ConfigStart/End
  + using system Expat
  + using -ldl for vendor DSO support
  + checking sizeof various data types
  + doing sanity check on compiler and options
  Creating Makefile in src/support
  Creating Makefile in src/os/unix
  Creating Makefile in src/ap
  Creating Makefile in src/main
  Creating Makefile in src/modules/standard
  Creating Makefile in src/modules/php4# make
# make install

make[1]: Leaving directory `/usr/src/apache_1.3.33'
+--------------------------------------------------------+
| You now have successfully built and installed the      |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the         |
| (initially created or preserved) configuration files   |
|                                                        |
|   /usr/local/apache/conf/httpd.conf
|                                                        |
| and then you should be able to immediately fire up     |
| Apache the first time by running:                      |
|                                                        |
|   /usr/local/apache/bin/apachectl start
|                                                        |
| Thanks for using Apache.       The Apache Group        |
|                                http://www.apache.org/  |
+--------------------------------------------------------+
# cp php.ini-dist /usr/local/lib/php.ini
# ln -s /usr/local/apache/bin/apachectl /usr/local/bin/apachectl
# ln -s /usr/local/apache/bin/httpd /usr/local/bin/httpd
# vi /usr/local/apache/conf/httpd.conf

# 告诉 Apache 将哪些后缀作为 PHP 解析。例如,让 Apache 把 .php
后缀的文件解析为 PHP。可以将任何后缀的文件解析为 PHP,只要在
以下语句中加入并用空格分开。AddType application/x-httpd-php .php .html .htm
AddType application/x-httpd-php-source .phps# apachectl start
# httpd -l

Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_status.c
mod_include.c
mod_autoindex.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.c
mod_actions.c
mod_speling.c
mod_userdir.c
mod_alias.c
mod_rewrite.c
mod_access.c
mod_auth.c
mod_so.c
mod_setenvif.c
mod_php4.c
suexec: disabled; invalid wrapper /usr/local/apache/bin/suexec(待解决)# echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local
# echo "/usr/local/mysql/support-files/mysql.server start" >> /etc/rc.d/rc.local

// MyChanges in php.ini
short_open_tag = Off
output_buffering = On
zlib.output_compression = On
safe_mode = On


安装 Apache 2.0.48 (查看Install手册)
考虑到以后要 rewite_url 来使 google 更加容易收录网站,特地添加了 mod_rewrite 。
同时为了限制流量,特别加了 mod_limitpcnn.c 补丁 , 所以多了一个 --enable-forward 选项。
建议安装完毕以后不要删除安装目录,以便以后升级时使用。
记得升级前关闭 apache2.0
编译过程:
#./configure --enable-so --enable-speling --enable-rewrite --with-ssl=/usr/local/ssl --enable-forward
# make
# make install


这个例子里面是编译了 mod_so,mod_speling 和 openssl 支持。同样有另外几种写法:#./configure --enable-so --enable-speling --enable-rewrite --with-ssl=/usr/local/ssl --enable-forward
# make
# make install


或者#./configure --enable-modules=”so speling”


--enable-MODULE[=shared] 编译并包含模块 MODULE. MODULE 是文档中去掉”_module ”的模块名。要将一个模块编译成为 DSO, 需要加 -shared 选项 , 即 --enable-mods-shared 。(查看 MODULE 手册)

注意 :"如果希望核心能够装载 DSO,而不实际编译任何动态模块,则要明确指定 --enable-modules=so 或者 --enable-so" (查看 DSO 手册),所以前面的顺序不能交换顺序。 查看所有apache 的 configure 参数

安装完毕后可以用以下命令来查看启动了那些模块

# apachectl -l
Compiled in modules:
core.c
mod_access.c
mod_auth.c
mod_include.c
mod_log_config.c
mod_env.c
mod_setenvif.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_cgi.c
mod_negotiation.c
mod_dir.c mod_imap.c
mod_actions.c
mod_speling.c
mod_userdir.c
mod_alias.c
mod_rewrite.c
mod_so.c


接着,将启动程序放入开机程序中去。 如果要启动 ssl 加密网页,则必须通过手动启动 apache2.0 (参见 ssl 部分)

# echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local


参考:
If you want your server to continue running after a system reboot , you should add a call to apachectl to your system startup files (typically rc.local or a file in an rc.N directory). This will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions.


在 profile 里面添加以上的语句来设置路径,使得在 bash 下更容易控制 apachectl, 省去了输入路径的麻烦。

# vi /etc/profile
PATH=" $PATH:usr/local/apache2/bin:”




配置 apache2.0
# vi /usr/local/apache2/conf/httpd.conf


配置文件请看文件 httpd.conf (设置文档目录为/home/dalouis/public_html)

#chmod 755 - R /home/dalouis/


设置目录的可读性为 drwxr-xr-x(755), 否则会出现 "Forbidden You don't have permission to access / on this server."


一些关于安全性的配置:
考虑到 cgi-bin 的安全性问题,我们暂时将 cgi-bin 去掉。将所有 httpd.conf 中的所有关于 cgi-bin 的行加上 "#".
Xiyang 的配置
我用的: mod_limitipconn, mod_expires, mod_gzip, mod_php4, mod_so, mod_access, mod_alias, mod_userdir, mod_dir, mod_autoindex, mod_status, mod_mime, mod_log_config, http_core


关于超时的问题
在我编写好所有的产品查看页面的时候,经常会出现因为超时,或者流量过大 ,apache 停止工作的问题,原因有二,一是代码的不科学性,二是 apache 的设置问题。

以下是对设置的一点改动:

# KeepAlive: Whether or not to allow persistent connections(more than
# one request per connection). Set to "Off" to deactivate.

# KeepAlive Off

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.

# MaxKeepAliveRequests 0

# KeepAliveTimeout: Number of seconds to wait for the next request
# from the same client on the same connection.

# KeepAliveTimeout 0


# 记录访问者的 HTTP-REFERER 和 AGENT, 有助于统计来者是通过什
么搜索引擎找到我们的网站的。 或者在原有的CustomLog行,将参数
由 common 改成 combined

# If you would like to have agent and referer logfiles,
# uncomment the following directives.

CustomLog logs/referer_log referer
CustomLog logs/agent_log agent
CustomLog logs/www.domain.com-access_log combined




使用 mod_limitipconn.c 来限制 apache 的并发数
Package: http://dominia.org/djao/limit/
安装使用说明: http://dominia.org/djao/limitipconn2-README

这里的安装建议使用动态 DSO 并 patch apache2.0, 以使得 apache2.0 可以认识在代理后方的 IP 。但是要 重新编译 apache2.0, 以下是原程序中 INSTALL 的介绍。

## Instructions for building DSO with proxy tracking:
# tar xzvf httpd-2.0.39.tar.gz
# tar xzvf mod_limitipconn-0.22.tar.gz
# cd httpd-2.0.39
# patch -p1 < ../mod_limitipconn-0.22/apachesrc.diff
# ./buildconf
# ./configure --enable-so --enable-speling --enable-rewrite \
--with-ssl=/usr/local/ssl --enable-forward
# make
# make install
# cd ../mod_limitipconn-0.22
# PATH=/usr/local/apache2/bin:$PATH
# make install 

安装过程
# lynx http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz
# tar -zxvf mod_limitipconn-0.22.tar.gz
# cd httpd-2.0.48
# patch -p1 < ../mod_limitipconn-0.22/apachesrc.diff

patching file configure.in
Hunk #1 succeeded at 373 (offset 55 lines).
patching file include/scoreboard.h
patching file modules/generators/mod_status.c 
Hunk #1 succeeded at 746 (offset -1 lines).
patching file server/scoreboard.c# ./configure --enable-so --enable-speling --enable-rewrite \
--with-ssl=/usr/local/ssl --enable-forward
# make
# make install
# cd ../mod_limitipconn-0.22
# PATH=/usr/local/apache2/bin:$PATH
# make install

----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apache2/modules
If you ever happen to want to link against installed libraries 
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR' 
flag during linking and do at least one of the following: 
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable 
during execution 
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for 
more information, such as the ld(1) and ld.so(8) manual pages.
---------------------------------------------------------------------- 
chmod 755 /usr/local/apache2/modules/mod_limitipconn.so
[activating module `limitipconn' in /usr/local/apache2/conf/httpd.conf] 

检查 httpd.conf 文件,发现增加了一下一行

LoadModule limitipconn_module modules/mod_limitipconn.so


同时需要设置以下参数在 httpd.conf 中 , 也可以在单个虚拟服务器中。

ExtendedStatus On
# Only needed if the module is compiled as a DSO
LoadModule limitipconn_module lib/apache/mod_limitipconn.so
<IfModule mod_limitipconn.c>
<Location /somewhere>
MaxConnPerIP 3
# exempting images from the connection limit is often a good
# idea if your web page has lots of inline images, since these
# pages often generate a flurry of concurrent image requests
# NoIPLimit image/*
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
# OnlyIPLimit audio/mpeg video
</Location>
</IfModule>


注意: LoadModule limitipconn_module modules/mod_limitipconn.so 必须放在虚拟服务器之前!否则不能启动。

定制 Apache index 目录
在 Apache 中设置目录 <Directory> 有 Options Indexes 属性的时候,可以索引文件夹内容,但是如果要定制显示的内容,就必须添加以下几行到各个服务器的设置中去。(可以是全局,也可以是虚拟服务器或者目录) MODULE: mod_autoindex

ReadmeName /README.shtml
HeaderName /HEADER.shtml
IndexOptions +SuppressHTMLPreamble FancyIndexing \
VersionSort FoldersFirst NameWidth=* (Optoional)


但是,我在按照步骤,添加以上设置、设置文件夹可被索引属性、制作页首和页尾上传后,仍旧发现不能显示。最终发现,由于我安装了 PHP, 为了使得 PHP 代码可以被嵌入 .html 和 .htm 文档中,我将 httpd.conf 中的一条属性设置为:

AddType application/x-httpd-php .php .html .htm


这使得 apache 不能识别原本设置的 README.html 和 HEADER.html,以下这点是从apache的文档中找到类似的解说.

参考

Filename must resolve to a document with a major content type of text/* ( e.g. , text/html , text/plain , etc.). This means that filename may refer to a CGI script if the script's actual file type (as opposed to its output) is marked as text/html such as with a directive like:

AddType text/html .cgi

Content negotiation will be performed if Options MultiViews is in effect. If filename resolves to a static text/html document (not a CGI script) and either one of the options Includes or IncludesNOEXEC is enabled, the file will be processed for server-side includes (see the mod_include documentation).


我将上述 PHP 的 Type 的最终 .html 和 .htm 去掉以后,就可以正常显示了。于是想办法新添加一个种后缀名为 README 和 HEADER 专用:

AddType text/html .shtml


然后修改 README.html 和 HEADER.html 为 README.shtml 和 HEADER.shtml 即可。要注意的是,因为我要列出的目录都为 open source, 所以有很多名字为“ README ”的文件。因此,要将其中的一条配置做小小的修改。(就是隐藏某些文件的配置)

IndexIgnore .??* *~ *# HEADER.* README.* RCS CVS *,v *,t


参考文档:
http://httpd.apache.org/docs-2.0/mod/mod_autoindex.html#headername

http://httpd.apache.org/docs-2.0/mod/mod_autoindex.html#indexoptions



让apache上的图片有防止盗链的功能
参考文档:
Preventing Image 'Theft' By: Ken Coar
Preventing hot linking of images by JavaScript Kit
SetEnvIfNoCase 和 SetEnvIf 的说明文档
http://httpd.apache.org/docs-2.0/mod/mod_setenvif.html#setenvif

httpd.conf 的修改处

######## Preventing Image 'Theft' ########

SetEnvIfNoCase Referer “^http://(.)+\.fjhr\.com/” local_ref=1
SetEnvIfNoCase Referer “^http://(.)+\.hzmjp\.com/” local_ref=1
SetEnvIfNoCase Referer “^http://(.)+\.dalouis\.com/” local_ref=1
SetEnvIfNoCase Referer “^http://(.)+\.necktie\.gov\.cn/” local_ref=1
SetEnvIfNoCase Referer “^http://(.)+\.necktie\.net\.cn/” local_ref=1
SetEnvIfNoCase Referer “-” local_ref=1
######## Allow the LOGO image Theft ##########
SetEnvIf Request_URI “/images/logo(.)+” local_ref=0

<FilesMatch “\.(png|gif|jpg)”>
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>

分享到:
评论

相关推荐

    Linux apache环境多域名配置

    ### Linux Apache环境多域名配置详解 #### 一、前言 在互联网开发中,单一服务器部署多个项目并分别对应不同的域名是一种常见的需求。这不仅能够提高服务器资源的利用率,还能帮助开发者更好地组织和管理不同类型...

    Linux下安装配置 Apache2.2.x+MySql5.x+PHP5.x 详解

    Linux 下安装配置 Apache2.2.x+MySql5.x+PHP5.x 详解 本篇文章详细介绍了在 Linux 操作系统下安装和配置 Apache2.2.x、MySql5.x 和 PHP5.x 的步骤,使用的操作系统为 Redhat AS5,内核版本为 Linux 2.6.18-8.el5,...

    apache for linux安装

    以上就是Apache在Linux环境下的安装和基础配置过程。这个过程中,你可能需要对Linux系统管理、网络服务和HTTP协议有一定的理解。如果你在安装过程中遇到任何问题,可以查阅Apache官方文档或在线社区寻求帮助。记住,...

    linux中apache安装与配置

    本文将详细介绍如何在Linux环境中安装和配置Apache,包括所需的依赖包和基本步骤。 首先,让我们从安装Apache开始。在大多数Linux发行版中,你可以通过包管理器来安装Apache。例如,在Ubuntu或Debian上,使用`apt`...

    linux离线安装apache

    在Linux环境下离线安装Apache服务器涉及多个步骤,包括但不限于安装必要的开发工具如GCC、G++等,以及配置相关的库文件如PCRE、OpenSSL等。本文将详细介绍整个流程,并针对特定的操作步骤提供指导。 #### 二、准备...

    RedHat9linuxapache安装配置[整理].pdf

    以下是对"RedHat9linuxapache安装配置[整理].pdf"文档中提到的知识点的详细解释: 1. **安装万维网服务器**:在Red Hat 9上,你可以通过yum包管理器来安装Apache。首先,更新系统包列表,然后执行`sudo yum install...

    RedHat9linuxapache安装配置.pdf

    在Red Hat 9 Linux系统中,Apache HTTP Server的安装与配置是进行Web服务的基础工作,对于技术人员来说,熟悉这一过程至关重要。以下将详细介绍标题和描述中提到的知识点,并且涵盖标签"技术"所涵盖的相关内容。 1....

    Linux下Apache安装

    本文将深入解析Linux环境下Apache的安装流程,涵盖解压缩、配置、编译、安装及启动验证等步骤。 #### 一、解压缩Apache源码包 首先,你需要获取Apache的源码包,通常是通过下载.tar.bz2格式的压缩文件。在本例中,...

    Linux下Apache+PHP+Mysql安装与配置

    Linux 下 Apache+PHP+Mysql 安装与配置 Apache installation * 介绍 Apache 的安装过程,包括卸载原有 Apache 用户、解压缩 Apache 源代码、配置和安装 Apache。 * "--prefix" 参数用于指定安装后的存放路径;"--...

    linux下安装apache的及反向代理配置完整过程

    Linux 下安装 Apache 及反向代理配置完整过程 Linux 操作系统下安装 Apache 服务器是一件复杂的任务,需要逐步完成多个步骤。本文将详细介绍 Linux 下安装 Apache 及反向代理配置的完整过程。 安装 Apache 安装 ...

    Linux下Apache配置详解

    Linux下Apache配置详解 学习必备

    linux 安装 apache 配置及步骤

    本教程将详细介绍在Linux上安装Apache的过程,以及如何解决可能出现的问题。我们将主要关注httpd-2.2和httpd-2.4两个版本,这两个版本都是Apache的常见版本。 **1. 确认Linux发行版** 在开始安装Apache之前,你需要...

    linux apache反向代理配置

    linux apache反向代理配置,写的有点乱,但是可以用,里面有说明文档 先弄 apache和tomcat整合 把80端口给apache 举例 tomcatA 8080 tomcatB 8081 在apache的httpd.conf里写反向代理,用户名指向tomcat的端口,具体...

    apache安装与配置文档

    Apache 安装与配置文档 Apache 安装与配置文档是 Apache 服务器的安装和配置指南。本文档将指导用户从安装 Apache 到配置 Apache 的整个过程。 一、Apache 安装 Apache 安装需要使用 root 用户进行安装。在安装...

    虚拟机中如何在Linux上安装和配置Apache服务器

    本文将详细介绍在 Linux 上安装和配置 Apache 服务器的步骤,并提供了详细的配置指导。 一、安装Apache服务器 在安装 Apache 服务器之前,需要下载相应的安装包,包括 httpd-2.4.3.tar.gz、apr-1.4.6.tar.gz、apr-...

    linux Apache安装(图文)

    在Linux上安装Apache涉及几个关键步骤,本文将详细讲解如何在Linux环境下安装和配置Apache。 首先,你需要访问Apache的官方网站www.apache.org下载适用于Linux的Apache安装程序。通常,官方提供的安装程序是tar.gz...

    CentOS Apache配置详解

    在本文中,我们详细介绍了 CentOS 上的 Apache 配置,包括安装、设置、配置文件、模块、文档根目录、错误日志文件、控制脚本、 MySQL 配置文件和 PHP 配置文件等。通过这些配置,我们可以实现一个功能强大且安全的...

    Linux下安装APACHE

    Linux 下安装 APACHE Linux 作为一个开源的操作系统,广泛应用于服务器端,APACHE 是一个流行的 Web 服务器软件,而安装 APACHE 在 Linux 下则需要遵循特定的步骤,以避免安装过程中的错误。 下载必要的文件 在...

    Apache2.4.6在Linux中安装及配置自启动

    总之,Apache2.4.6在Linux上的安装和配置涉及多个步骤,包括安装服务、调整配置、设置自启动以及管理模块和虚拟主机。通过实践和学习,你可以掌握这些技能,为你的网站提供稳定、高效的运行环境。

    linux 下配置 Apache 详解

    ### Linux 下配置 Apache 详解 #### 一、引言 Apache 是一款历史悠久且功能极其强大的 Web 服务器软件。由于其高度可定制性与模块化设计,对于初学者来说可能存在一定的学习曲线。Apache 的核心优势在于它能够通过...

Global site tag (gtag.js) - Google Analytics