how to create a VirtualHost to serve only static content

谁说胖子不能爱 提交于 2019-12-04 20:41:01

问题


I want to create a virtual host in apache such that it serves only static content like stylesheets, videos, images, javascripts, text files, etc. I am not looking at any "processing" capabilities from this virtual host.


回答1:


Create a VirtualHost entry as follows:

<VirtualHost *:80>
    ServerAdmin admin@domain.tld
    ServerName media.domain.tld

    DocumentRoot "/Library/WebServer/Documents/media"

    ErrorLog "/private/var/log/apache2/media-error_log"
    CustomLog "/private/var/log/apache2/media-access_log" common

    <Directory /Library/WebServer/Documents/media>
    Order deny,allow
    Allow from all
    SetHandler default-handler
    </Directory>

</VirtualHost>


来源:https://stackoverflow.com/questions/3112577/how-to-create-a-virtualhost-to-serve-only-static-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!