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