I want to set up a domain called img.mydomain.com. It will be a virtual domain that just like my actual domain except for one difference: it will only serve files that end in .jpg .jpeg .gif .png etc. This way I can refer to img.mydomain.com/some_image.jpg. it will speed up the page speed by making the browser think that it's two separate domains (google page speed analyzer is always nagging me to do this).
I'm running apache on a linux server. Should I do this in httpd.conf? If so, what is my first step?
create 2 folder for each domains (for example):
here's what you can put in your httpd.conf
<VirtualHost *:80>
DocumentRoot "/var/www/domain.com"
ServerName domain.com
ServerAlias domain.com www.domain.com
<Directory "/var/www/domain.com">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/img.domain.com/"
ServerName img.domain.com
ServerAlias img.domain.com
<Directory "/var/www/img.domain.com/">
allow from all
Options +Indexes
</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