|
||||||||
|
||||||||
|
|
Công Cụ | Xếp Bài |
17-06-2014, 05:42 PM | #1 |
Guest
Trả Lời: n/a
|
How to create your own CDN server using Nginx
How to create your own CDN server using Nginx
Step1. install nginx. yum install nginx Step2. goto /etc/nginx/conf.d folder and backup all configuration files. mkdir backups mv *.conf backups Step3. create a new file using: vim pass.conf Step4. Put following text into that file: server { listen 80; server_name static.yourdomain.com; location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html| js|css|mp3|swf|ico|flv)$ { expires max; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://yourdomain.com; proxy_ignore_headers X-Accel-Expires Expires Cache-Control; proxy_store /var/www/cache$uri; proxy_store_access user:rw group:rw all:r; } } Step5. save using :wand quit :q. Step6. add nginx to startup services. chkconfig nginx on Step7. start nginx. service nginx start For this to work, you should create a cache folder under /var/www and it should have appropriate folder permissions for nginx to work. You should add now forward all static resources to this server, if it is not found nginx will download file from server and cache it to its own cache directory. Have fun. References: 1. http://blog.unixy.net/2010/07/how-to...x-and-varnish/ 2. http://www.cyberciti.biz/faq/install...g-yum-command/ |
|
|