Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 17-06-2014, 05:42 PM   #1
hoctinhoc
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/




  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời



Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 06:27 AM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.