Separating the picture service from the app service

Source: Internet
Author: User
Tags app service

Requirements to separate image services from application services

With the image Service and app service on the same server, the application server can easily crash because of the high I/O load on the image, so for some large web sites it is necessary to separate the image server from the application server.

192.168.0.1 as an NFS server (also a picture server) 192.168.0.2 as a client,

One: First install NFS on the image server, you need to make the following configuration for NFS

Server for NFS:

Vi/etc/exports

Add local file directories and corresponding client addresses and permissions to be shared

Add to:

/data/pic 192.168.0.2 (Rw,no_root_squash,sync)

Execute: exportfs-r, re-refresh the configuration

Second, mount the application server using the following command

Mount-t NFS 192.168.0.1:/data/pic/data/www/photos

Three: How can I access pictures of the image server?

Nginx Configuration

server {

Listen 80;

server_name arbitrarily configure IP configuration native IP can;

Root/data/www

Index index.html index.htm index.php;

Location ~* ^/photo {

Rewrite ^/photo/(. *) $ http://192.168.0.2/photos/$1;

}

}

So when the user accesses the picture is actually access to the 192.168.0.1:/data/pic

Separating the picture service from the app service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.