同个目录多个端口Apache站点设置

适用于 CI、TP等php框架
请求地址

原来访问地址是http://127.0.0.1/diy.php/
配置以后是http://127.0.0.1:888

Apache配置信息
Listen 888

DocumentRoot "/home/wwwroot/yourdomain"
DirectoryIndex diy.php
#解决跨域资源访问
# Header set Access-Control-Allow-Origin "*"
    
        Options +Indexes +Includes +FollowSymLinks 
        AllowOverride All
        Order Allow,Deny
        Allow from all
    
    RewriteEngine on
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME}   !-s
    RewriteRule ^(.*)$ /diy.php/$1 [L]

修改Listen 888监听端口888即可完成同个目录多个端口访问,或者多站点访问

你可能感兴趣的:(同个目录多个端口Apache站点设置)