当前位置:web 服务器 > Apache >>

Apache虚拟主机配置简单例子

具体如下:

 

VirtualHost *:80> 
    DocumentRoot "/data/www/test" 
    ServerName test.58tech.com 
    RewriteEngine on 
 
    RewriteEngine on 
    RewriteRule ^/rule$  /rule/ [R] 
    RewriteRule ^/rule/$ /test2013/5033/test/index.shtml [L,PT] 
    RewriteRule ^/signup$  /signup/ [R] 
    RewriteRule ^/signup/$ /s2013/5033/test200545034/index.shtml [L,PT] 
 
    <Directory "/data/www/test"> 
                AllowOverride None 
                Options Includes FollowSymLinks 
                Order allow,deny 
                Allow from all 
                Options +Includes 
                AddType text/html .shtml 
                AddOutputFilter INCLUDES .shtml .inc 
    </Directory> 
    DirectoryIndex /my/test/index/index.shtml 
    #ErrorLog /dev/null 
    #LogLevel crit 
    CustomLog "|/58tech/pkg/apache2/bin/rotatelogs /data/logs/58tech_access_log.%Y%m%d 86400 480" combined 
</VirtualHost> 
 
 
 

实现如下: 


<VirtualHost *:80>
    DocumentRoot "/data/www/test"
    ServerName test.58tech.com
    RewriteEngine on

    RewriteEngine on
    RewriteRule ^/rule$  /rule/ [R]
    RewriteRule ^/rule/$ /test2013/5033/test/index.shtml [L,PT]
    RewriteRule ^/signup$  /signup/ [R]
    RewriteRule ^/signup/$ /s2013/5033/test200545034/index.shtml [L,PT]

    <Directory "/data/www/test">
                AllowOverride None
                Options Includes FollowSymLinks
                Order allow,deny
                Allow from all
                Options +Includes
                AddType text/html .shtml
                AddOutputFilter INCLUDES .shtml .inc
    </Directory>
    DirectoryIndex /my/test/index/index.shtml
    #ErrorLog /dev/null
    #LogLevel crit
    CustomLog "|/58tech/pkg/apache2/bin/rotatelogs /data/logs/58tech_access_log.%Y%m%d 86400 480" combined
</VirtualHost>

 


实现如下  

 http://test.58tech.com  打开: /my/test/index/index.shtml     
 
 
http://test.58tech.com/rule  打开: /test2013/5033/test/index.shtml  地址栏: http://test.58tech.com/rule/ 
 
http://test.58tech.com/signup  打开: /s2013/5033/test200545034/index.shtml  地址栏: http://test.58tech.com/signup/

 http://test.58tech.com  打开: /my/test/index/index.shtml   


http://test.58tech.com/rule  打开: /test2013/5033/test/index.shtml  地址栏: http://test.58tech.com/rule/

http://test.58tech.com/signup  打开: /s2013/5033/test200545034/index.shtml  地址栏: http://test.58tech.com/signup/

 

 

补充:移动开发 , Android ,
Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
访问www.zzzyk.com 试试
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,