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.
There are three steps to requesting static content from a server: A user sends a request for a file to the web server. The web server retrieves the file from disk. The web server sends the file to the user.
Simply put, Apache HTTP server is a web server designed to serve static web pages. Whereas, Apache Tomcat is an application server built to serve java applications. Web pages can still be served through Apache Tomcat, but it will be less efficient than using an Apache HTTP server.
Create a VirtualHost
entry as follows:
<VirtualHost *:80>
ServerAdmin [email protected]
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With