zoukankan      html  css  js  c++  java
  • Apache2的配置文件, 用PHP扩展名伪装Java网站

    增加PHP解析支持

      LoadModule php5_module modules/libphp5.so
    
    
      # Use of the "ZTS" build with worker is experimental, and no shared
      # modules are supported.
      LoadModule php5_module modules/libphp5-zts.so
    
    
    AddHandler php5-script .php
    AddType text/html .php
    
    # Add index.php to the list of files that will be served as directory
    # indexes.
    DirectoryIndex index.php

    Add the support of PHP handling

      LoadModule php5_module modules/libphp5.so
    
    
      # Use of the "ZTS" build with worker is experimental, and no shared
      # modules are supported.
      LoadModule php5_module modules/libphp5-zts.so
    
    
    AddHandler php5-script .php
    AddType text/html .php
    
    # Add index.php to the list of files that will be served as directory
    # indexes.
    DirectoryIndex index.php

    如果项目中, apache同时配置了与Tomcat的连接, 而且打算用PHP扩展名给java程序做伪装, 就需要注释掉这两行 AddHandler php5-script .php AddType text/html .php 而将这两行添加到需要PHP解析的虚拟目录配置文件下. 例如, 一个使用PHP扩展名伪装的java站点虚拟目录配置为

       ServerName mailman.someorg.com
    
      # Send servlet for context /servlets-examples to worker named worker1
       JkMount  /mailman/*.php worker1
       JkMount  /mailman/* worker1
    
       DocumentRoot /var/www/html/mailman/
       DirectoryIndex index.shtml index.html index.htm index.php index.jsp
    
       Options +Includes
       AddType text/html .shtml
       AddOutputFilter INCLUDES .shtml
       AddHandler server-parsed .shtml
    
       <Directory "/var/www/html/mailman/">
           Options FollowSymLinks IncludesNOEXEC
           AllowOverride None
           Order allow,deny
           Allow from all
       
    
       ErrorLog logs/mailman.someorg.com-err_log
       CustomLog logs/mailman.someorg.com-access_log combined
    

    而一个需要PHP解析支持的虚拟目录配置为

    	ServerName misc.someorg.com
    
    	DocumentRoot /var/www/html/misc/
    	DirectoryIndex index.shtml index.html index.htm default.htm index.php index.jsp
    
    	Options +Includes
    	AddType text/html .shtml
    	AddOutputFilter INCLUDES .shtml
    	AddHandler server-parsed .shtml
    	AddHandler php5-script .php
    	AddType text/html .php
    
    	<Directory "/var/www/html/misc/">
    		Options FollowSymLinks IncludesNOEXEC
    		AllowOverride None
    		Order allow,deny
    		Allow from all
    	
    
    	ErrorLog logs/misc.someorg.com-err_log
    	CustomLog logs/misc.someorg.com-access_log combined
    

    这些配置都同时打开了对server side include SSI的支持

    If you are going to use the .php extension for Java web application, comment out the two lines below

    AddHandler php5-script .php
    AddType text/html .php

    And add these two lines to the VirutalHost configuration. For example, the virtual host configuration of a Java website is

       ServerName mailman.someorg.com
    
      # Send servlet for context /servlets-examples to worker named worker1
       JkMount  /mailman/*.php worker1
       JkMount  /mailman/* worker1
    
       DocumentRoot /var/www/html/mailman/
       DirectoryIndex index.shtml index.html index.htm index.php index.jsp
    
       Options +Includes
       AddType text/html .shtml
       AddOutputFilter INCLUDES .shtml
       AddHandler server-parsed .shtml
    
       <Directory "/var/www/html/mailman/">
           Options FollowSymLinks IncludesNOEXEC
           AllowOverride None
           Order allow,deny
           Allow from all
       
    
       ErrorLog logs/mailman.someorg.com-err_log
       CustomLog logs/mailman.someorg.com-access_log combined
    

    While the configuration of a virtual host that need to support PHP is

    	ServerName misc.someorg.com
    
    	DocumentRoot /var/www/html/misc/
    	DirectoryIndex index.shtml index.html index.htm default.htm index.php index.jsp
    
    	Options +Includes
    	AddType text/html .shtml
    	AddOutputFilter INCLUDES .shtml
    	AddHandler server-parsed .shtml
    	AddHandler php5-script .php
    	AddType text/html .php
    
    	<Directory "/var/www/html/misc/">
    		Options FollowSymLinks IncludesNOEXEC
    		AllowOverride None
    		Order allow,deny
    		Allow from all
    	
    
    	ErrorLog logs/misc.someorg.com-err_log
    	CustomLog logs/misc.someorg.com-access_log combined
    

    The configurations both enabled the support for Server Side Include (SSI)

  • 相关阅读:
    POJ1239
    HDU 2829 四边形不等式优化
    返回数字二进制的最高位位数o(n)
    矩阵快速幂 模板
    HDU4718 The LCIS on the Tree(LCT)
    HDU4010 Query on The Trees(LCT)
    HDU3487 Play With Chains(Splay)
    CF444C DZY Loves Colors
    HDU4836 The Query on the Tree(树状数组&&LCA)
    HDU4831&&4832&&4834
  • 原文地址:https://www.cnblogs.com/milton/p/4215055.html
Copyright © 2011-2022 走看看