我想为图像的单独的域 [英] I want to make a separate domain for images

查看:180
本文介绍了我想为图像的单独的域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个名为img.mydomain.com域。这将是就像我的实际域名,除了一个区别一个虚拟域:它只会在结尾的文件JPG格式的.jpeg,.gif和.png等。这样我可以参考im​​g.mydomain.com/some_image.jpg 。它会通过浏览器认为这是两个不同领域(谷歌网页速度仪总是唠叨我做这件事)加快了速度。

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).

我在Linux服务器上运行的Apache。我应该这样做在httpd.conf?如果是这样,什么是我的第一步是什么?

I'm running apache on a linux server. Should I do this in httpd.conf? If so, what is my first step?

推荐答案

创建2个文件夹,每个域(例如):

create 2 folder for each domains (for example):


  • /var/www/domain.com

  • /var/www/img.domain.com /

下面就是你可以把你的httpd.conf

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>

这篇关于我想为图像的单独的域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆