Accessing static files through Apache HTTP Server in Linux
This post will explain accessing static files through Apache HTTP Server in LinuxCreate a folder in server to store the static files e.g. /app/apache/static/
Copy all the static files to /app/apache/static/ folder
Add the below contents to httpd.conf file
##Grant the access to unix user that will access the static folder
<IfModule unixd_module>
User apacheuser
Group apacheuser
</IfModule>
DirectoryIndex index.htm index.html
ErrorDocument 400 /error.html
ErrorDocument 401 /error.html
ErrorDocument 403 /error.html
ErrorDocument 404 /error.html
ErrorDocument 405 /error.html
ErrorDocument 408 /error.html
ErrorDocument 414 /error.html
ErrorDocument 500 /error.html
ErrorDocument 502 /error.html
ErrorDocument 504 /error.html
<VirtualHost *:80>
ServerName staticfiles.com:80
DocumentRoot /app/apache/static/
Alias /files "/app/apache/static"
<Directory /app/apache/static>
Order deny,allow
Allow from all
SetHandler default-handler
</Directory>
</VirtualHost>
Now we can access the static file with the following url - http://staticfiles.com/files/<<file name>>
The Apache server referred here is 2.2.15
Hi Albin,
ReplyDeleteOne can access whatever file that is placed in the Docroot from the IP/VIP.. etc mapped to the doc root(Provided the browser is compatible enough to accept the mime type).