Operating platform: CentOS
Requirements: Like this
/opt/virtual.file
Point to: /opt/1.file
/opt/2.file
/opt/3.file
First, I know the merge command, but this creates a new file and takes up space
What I want is access /opt/virtual.file
, equivalent to the system dynamically merging these three files into one as one to access
This requirement is not a request to merge Js/css with Nginx_http_concat
Because when uploading the file in order to ensure stability, according to the case of 5m/block upload, although you can also use the program to merge these blocks, but there is no software can let the system do virtual files, point to these tiles, so you can not merge
Reply content:
Operating platform: CentOS
Requirements: Like this
/opt/virtual.file
Point to: /opt/1.file
/opt/2.file
/opt/3.file
First, I know the merge command, but this creates a new file and takes up space
What I want is access /opt/virtual.file
, equivalent to the system dynamically merging these three files into one as one to access
This requirement is not a request to merge Js/css with Nginx_http_concat
Because when uploading the file in order to ensure stability, according to the case of 5m/block upload, although you can also use the program to merge these blocks, but there is no software can let the system do virtual files, point to these tiles, so you can not merge
This must be done using fuse, as well as written by the Great God: https://github.com/schlaile/c ...
Install the compilation Concatfs
yum install fuse fuse-develgit clone https://github.com/schlaile/concatfs.gitcd concatfs/srcgcc -Wall concatfs.c `pkg-config fuse --cflags --libs` -o concatfscp ./concatfs /bin
To start a directory by using Mount mode
Original directory:
/opt/www/website/
Contains files inside
index.html
test.html
Create a directory to mount
mkdir /opt/www/website_mnt
Perform
concatfs /opt/www/website/ /opt/www/website_mnt
It's running in the background without an error.
Create a special file name that contains-concat-
As long as the inclusion of-concat-will be CONCATFS special parsing
vim /opt/www/website/1-concat-.txt
Content
index.htmltest.html
Note that the end column also needs a carriage return LF, otherwise the last file will not load
Now /opt/www/website_mnt/1-concat-.txt
the access will return the data after the merging of these two files
The equivalent of these two files are dynamically merged, actually not physically merged
Note is the website_mnt/1-concat-.txt
directory
Access to the original directory website/1-concat-.txt
is still the original file
PS: There is no test write /opt/www/website_mnt/1-concat-.txt
case