<article><h2 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 2.13em; font-weight: 100;">nginx相关软件</h2><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">nginx-1.10.1&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="http://nginx.org/en/download.html" target="_blank">http://nginx.org/en/download.html</a>&nbsp;<br/>nginx清除缓存模块 ngx_cache_purge-2.3&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="http://labs.frickle.com/nginx_ngx_cache_purge/" target="_blank">http://labs.frickle.com/nginx_ngx_cache_purge/</a>&nbsp;<br/>pcre-8.36&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="https://sourceforge.net/projects/pcre/files/pcre/8.36/" target="_blank">https://sourceforge.net/projects/pcre/files/pcre/8.36/</a>&nbsp;<br/>zlib库&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="http://zlib.net/zlib-1.2.8.tar.gz" target="_blank">http://zlib.net/zlib-1.2.8.tar.gz</a></p><h2 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 2.13em; font-weight: 100;">FastDFS相关软件</h2><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">FastDFS_v5.08&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="https://sourceforge.net/projects/fastdfs/files/FastDFS%20Server%20Source%20Code/stats/timeline" target="_blank">https://sourceforge.net/projects/fastdfs/files/FastDFS%20Server%20Source%20Code/stats/timeline</a>&nbsp;<br/>或者<a style="color: rgb(12, 137, 207);" href="https://github.com/happyfish100/fastdfs" target="_blank">https://github.com/happyfish100/fastdfs</a>&nbsp;<br/>FastDFS Nginx Module 1.16&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="http://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/" target="_blank">http://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/</a>&nbsp;<br/>或者<a style="color: rgb(12, 137, 207);" href="https://github.com/happyfish100/fastdfs-nginx-module" target="_blank">https://github.com/happyfish100/fastdfs-nginx-module</a>&nbsp;<br/>libfastcommon&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="https://github.com/happyfish100/libfastcommon" target="_blank">https://github.com/happyfish100/libfastcommon</a>&nbsp;<br/>其中github上的代码是最新的,sourceforge上不一定是最新的,当前FastDFS版本为5.08。&nbsp;<br/><img src="/dokuwiki/ueditor/php/upload/image/20180517/1526534904479330.jpg" title="1526534904479330.jpg" alt="20160622100029775.jpg"/></p><h2 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 2.13em; font-weight: 100;">tracker的安装与配置</h2><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">以下操作是在 tracker 10.10.10.80上操作。&nbsp;<br/>通过rz工具或者FileZilla,把软件上传到Ubuntu的/usr/local/src目录下。</p><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">安装libfastcommon</h3><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:/usr/local/src#&nbsp;unzip&nbsp;libfastcommon-master.zip&nbsp;root@tracker:/usr/local/src#&nbsp;cd&nbsp;libfastcommon-masterroot@tracker:/usr/local/src/libfastcommon-master#&nbsp;lsHISTORY&nbsp;&nbsp;INSTALL&nbsp;&nbsp;libfastcommon.spec&nbsp;&nbsp;make.sh&nbsp;&nbsp;php-fastcommon&nbsp;&nbsp;README&nbsp;&nbsp;src root@tracker:/usr/local/src/libfastcommon-master#&nbsp;./make.sh&nbsp;root@tracker:/usr/local/src/libfastcommon-master#&nbsp;./make.sh&nbsp;install123456123456</pre><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">安装FastDFS (FastDFS_v5.08.tar.gz)</h3><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:/usr/local/src#&nbsp;tar&nbsp;zxvf&nbsp;FastDFS_v5.08.tar.gz&nbsp;root@tracker:/usr/local/src#&nbsp;cd&nbsp;FastDFSroot@tracker:/usr/local/src/FastDFS#&nbsp;./make.shroot@tracker:/usr/local/src/FastDFS#&nbsp;./make.sh&nbsp;install&nbsp;12341234</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">到这里FastDFS在 tracker上安装完成,所有的可执行文件位于 /usr/bin 目录下,以fdfs开头的文件:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:~$&nbsp;ll&nbsp;/usr/bin/fdfs_*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;379725&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_appender_test*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;375174&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_appender_test1*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;356800&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_append_file*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;356994&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_crc32*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;356827&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_delete_file*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;357754&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_download_file*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;357928&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_file_info*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;377621&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_monitor*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;1313605&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_storaged*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;389327&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_test*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;387896&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_test1*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;539675&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_trackerd*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;357728&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_upload_appender*-rwxr-xr-x&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;363268&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;/usr/bin/fdfs_upload_file*123456789101112131415123456789101112131415</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">所有的配置文件在 /etc/fdfs/ 目录下:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:~$&nbsp;ll&nbsp;/etc/fdfs/total&nbsp;28drwxr-xr-x&nbsp;&nbsp;&nbsp;2&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:33&nbsp;./drwxr-xr-x&nbsp;117&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:44&nbsp;../-rwxr-xr-x&nbsp;&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;1463&nbsp;Jun&nbsp;16&nbsp;19:32&nbsp;client.conf.sample-rwxr-xr-x&nbsp;&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;7927&nbsp;Jun&nbsp;16&nbsp;19:25&nbsp;storage.conf.sample-rwxr-xr-x&nbsp;&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;7202&nbsp;Jun&nbsp;16&nbsp;19:33&nbsp;tracker.conf.sample12345671234567</pre><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">配置</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">①进入到 /etc/fdfs 目录下,将tracker.conf.sample重命名为tracker.conf。</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:/etc/fdfs#&nbsp;mv&nbsp;tracker.conf.sample&nbsp;tracker.conf11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">②创建数据文件和日志文件目录</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:/etc/fdfs#&nbsp;mkdir&nbsp;-pv&nbsp;/data/fastdfs/trackermkdir:&nbsp;已创建目录&nbsp;&quot;/data&quot;mkdir:&nbsp;已创建目录&nbsp;&quot;/data/fastdfs&quot;mkdir:&nbsp;已创建目录&nbsp;&quot;/data/fastdfs/tracker&quot;12341234</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">③编辑 tracker.conf 文件,测试的时候只需要修改以下参数即可</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">disabled=false&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#启用配置文件port=22122&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#设置&nbsp;tracker&nbsp;的端口号base_path=/data/fastdfs/tracker&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#设置&nbsp;tracker&nbsp;的数据文件和日志目录(需预先创建)http.server_port=8888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#设置&nbsp;http&nbsp;端口号这个http.server_port=8888&nbsp;指的是在tracker服务器上启动http服务进程,如:apache或者nginx&nbsp;启动时所监听的端口1234512345</pre><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">运行</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">直接使用 fdfs_trackerd 来启动tracker进程,然后使用netstat 查看端口是否起来。</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:/etc/fdfs#&nbsp;fdfs_trackerd&nbsp;/etc/fdfs/tracker.conf&nbsp;restartroot@tracker:/etc/fdfs#&nbsp;netstat&nbsp;-antp&nbsp;|&nbsp;grep&nbsp;trackerdtcp&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;0.0.0.0:22122&nbsp;&nbsp;&nbsp;0.0.0.0:*&nbsp;&nbsp;&nbsp;LISTEN&nbsp;&nbsp;&nbsp;14520/fdfs_trackerd&nbsp; root@tracker:/etc/fdfs#&nbsp;12341234</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">也可以查看日志看服务是否正常运行:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:~#&nbsp;cat&nbsp;/data/fastdfs/tracker/logs/trackerd.log11</pre><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">[2016-06-28&nbsp;11:55:55]&nbsp;INFO&nbsp;-&nbsp;FastDFS&nbsp;v5.08,&nbsp;base_path=/data/fastdfs/tracker,&nbsp;run_by_group=,&nbsp;run_by_user=,&nbsp;connect_timeout=30s,&nbsp;network_timeout=60s,&nbsp;port=22122,&nbsp;bind_addr=,&nbsp;max_connections=2048,&nbsp;accept_threads=1,&nbsp;work_threads=4,&nbsp;store_lookup=2,&nbsp;store_group=,&nbsp;store_server=0,&nbsp;store_path=0,&nbsp;reserved_storage_space=10.00%,&nbsp;download_server=0,&nbsp;allow_ip_count=-1,&nbsp;sync_log_buff_interval=10s,&nbsp;check_active_interval=120s,&nbsp;thread_stack_size=64&nbsp;KB,&nbsp;storage_ip_changed_auto_adjust=1,&nbsp;storage_sync_file_max_delay=86400s,&nbsp;storage_sync_file_max_time=300s,&nbsp;use_trunk_file=0,&nbsp;slot_min_size=256,&nbsp;slot_max_size=16&nbsp;MB,&nbsp;trunk_file_size=64&nbsp;MB,&nbsp;trunk_create_file_advance=0,&nbsp;trunk_create_file_time_base=02:00,&nbsp;trunk_create_file_interval=86400,&nbsp;trunk_create_file_space_threshold=20&nbsp;GB,&nbsp;trunk_init_check_occupying=0,&nbsp;trunk_init_reload_from_binlog=0,&nbsp;trunk_compress_binlog_min_interval=0,&nbsp;use_storage_id=0,&nbsp;id_type_in_filename=ip,&nbsp;storage_id_count=0,&nbsp;rotate_error_log=0,&nbsp;error_log_rotate_time=00:00,&nbsp;rotate_error_log_size=0,&nbsp;log_file_keep_days=0,&nbsp;store_slave_file_use_link=0,&nbsp;use_connection_pool=0,&nbsp;g_connection_pool_max_idle_time=3600s [2016-06-28&nbsp;11:56:01]&nbsp;INFO&nbsp;-&nbsp;file:&nbsp;tracker_relationship.c,&nbsp;line:&nbsp;383,&nbsp;selecting&nbsp;leader… [2016-06-28&nbsp;11:56:02]&nbsp;INFO&nbsp;-&nbsp;file:&nbsp;tracker_relationship.c,&nbsp;line:&nbsp;401,&nbsp;I&nbsp;am&nbsp;the&nbsp;new&nbsp;tracker&nbsp;leader&nbsp;10.10.10.80:22122123123</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">⑤设置开机自动启动</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@tracker:/etc#&nbsp;vi&nbsp;rc.local&nbsp;/usr/bin/fdfs_trackerd&nbsp;/etc/fdfs/tracker.conf&nbsp;restart1212</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">至此tracker上的安装与配置结束。</p><h2 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 2.13em; font-weight: 100;">storage的安装与配置</h2><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">两台机器(10.10.10.81, 10.10.10.82)配置完全一样,以81为例。</p><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">安装</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">利用上传 FastDFS_v5.08.tar.gz 和 libfastcommon-master.zip 至 storage服务器的/usr/local/src 目录下,解压安装 libfastcommon,这个和前面安装tracker一样。</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">安装libfastcommon root@storage1:/usr/local/src#&nbsp;unzip&nbsp;libfastcommon-master.zip&nbsp;root@storage1:/usr/local/src#&nbsp;cd&nbsp;libfastcommon-masterroot@storage1:/usr/local/src/libfastcommon-master#&nbsp;lsHISTORY&nbsp;&nbsp;INSTALL&nbsp;&nbsp;libfastcommon.spec&nbsp;&nbsp;make.sh&nbsp;&nbsp;php-fastcommon&nbsp;&nbsp;README&nbsp;&nbsp;src root@storage1:/usr/local/src/libfastcommon-master#&nbsp;./make.sh&nbsp;root@storage1:/usr/local/src/libfastcommon-master#&nbsp;./make.sh&nbsp;install12345671234567</pre><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">安装FastDFSFastDFS_v5.08.tar.gz root@storage1:/usr/local/src#&nbsp;tar&nbsp;zxvf&nbsp;FastDFS_v5.08.tar.gz&nbsp;root@storage1:/usr/local/src#&nbsp;cd&nbsp;FastDFSroot@storage1:/usr/local/src/FastDFS#&nbsp;./make.shroot@storage1:/usr/local/src/FastDFS#&nbsp;./make.sh&nbsp;install&nbsp;123456123456</pre><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">配置</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">进入到 /etc/fdfs 目录下,复制/usr/local/src/FastDFS/conf/* 下面的所有文件到当前目录下(/etc/fdfs):</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/etc/fdfs$&nbsp;ll total&nbsp;96drwxr-xr-x&nbsp;&nbsp;2&nbsp;root&nbsp;root&nbsp;&nbsp;4096&nbsp;Jun&nbsp;17&nbsp;16:07&nbsp;./drwxr-xr-x&nbsp;97&nbsp;root&nbsp;root&nbsp;&nbsp;4096&nbsp;Jun&nbsp;17&nbsp;15:28&nbsp;../-rwxr-xr-x&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;23981&nbsp;Jun&nbsp;16&nbsp;20:06&nbsp;anti-steal.jpg-rwxr-xr-x&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;1461&nbsp;Jun&nbsp;16&nbsp;20:06&nbsp;client.conf-rwxr-xr-x&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;&nbsp;858&nbsp;Jun&nbsp;16&nbsp;20:06&nbsp;http.conf-rwxr-xr-x&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;31172&nbsp;Jun&nbsp;16&nbsp;20:06&nbsp;mime.types-rwxr-xr-x&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;7910&nbsp;Jun&nbsp;17&nbsp;09:40&nbsp;storage.conf-rwxr-xr-x&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;&nbsp;105&nbsp;Jun&nbsp;16&nbsp;20:06&nbsp;storage_ids.conf-rwxr-xr-x&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;7202&nbsp;May&nbsp;20&nbsp;10:45&nbsp;tracker.conf12345678910111234567891011</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">编辑配置文件 storage.conf 测试的时候,只需修改以下内容即可</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/etc/fdfs$&nbsp;vi&nbsp;storage.conf&nbsp; disabled=false&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#启用配置文件group_name=group1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#组名,根据实际情况修改port=23000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#设置&nbsp;storage&nbsp;的端口号base_path=/data/fastdfs/storage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#设置&nbsp;storage&nbsp;的日志目录(需预先创建)store_path_count=1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#存储路径个数,需要和&nbsp;store_path&nbsp;个数匹配store_path0=/data/fastdfs/storage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#存储路径tracker_server=10.10.10.81:22122&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#tracker&nbsp;服务器的&nbsp;IP&nbsp;地址和端口号http.server_port=8888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#设置storage上启动的http服务的端口号,如安装的nginx的端口号123456789123456789</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">[备注]:store_path_count如果有多个,那么需要设置多个存储路径,如:</p><blockquote style="margin: 0px 0px 1.1em; padding: 15px 20px; color: rgb(63, 63, 63); font-family: &quot;microsoft yahei&quot;; font-size: 15px;"><p style="line-height: 1.25; padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px;">store_path_count=2&nbsp;<br/>store_path0=/data/fastdfs/storage&nbsp;<br/>store_path1=/data/fastdfs/storage1</p></blockquote><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">运行</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">执行如下命令:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/etc/fdfs#&nbsp;fdfs_storaged&nbsp;/etc/fdfs/storage.conf&nbsp;restart11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">查看进程是否运行:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@dstorage1:/etc/fdfs#&nbsp;netstat&nbsp;-antp&nbsp;|&nbsp;grep&nbsp;storagetcp&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;0.0.0.0:23000&nbsp;&nbsp;&nbsp;0.0.0.0:*&nbsp;&nbsp;&nbsp;LISTEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;23426/fdfs_storaged1212</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">观察日志 /data/fastdfs/storage/logs/storaged.log 看运行情况</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">mkdir&nbsp;data&nbsp;path:&nbsp;FB&nbsp;…mkdir&nbsp;data&nbsp;path:&nbsp;FC&nbsp;…mkdir&nbsp;data&nbsp;path:&nbsp;FD&nbsp;…mkdir&nbsp;data&nbsp;path:&nbsp;FE&nbsp;…mkdir&nbsp;data&nbsp;path:&nbsp;FF&nbsp;…data&nbsp;path:&nbsp;/data/fastdfs/storage/data,&nbsp;mkdir&nbsp;sub&nbsp;dir&nbsp;done. [2016-06-16&nbsp;19:51:04]&nbsp;INFO&nbsp;-&nbsp;file:&nbsp;storage_param_getter.c,&nbsp;line:&nbsp;191,&nbsp;use_storage_id=0,&nbsp;id_type_in_filename=ip,&nbsp;storage_ip_changed_auto_adjust=1,&nbsp;store_path=0,&nbsp;reserved_storage_space=10.00%,&nbsp;use_trunk_file=0,&nbsp;slot_min_size=256,&nbsp;slot_max_size=16&nbsp;MB,&nbsp;trunk_file_size=64&nbsp;MB,&nbsp;trunk_create_file_advance=0,&nbsp;trunk_create_file_time_base=02:00,&nbsp;trunk_create_file_interval=86400,&nbsp;trunk_create_file_space_threshold=20&nbsp;GB,&nbsp;trunk_init_check_occupying=0,&nbsp;trunk_init_reload_from_binlog=0,&nbsp;trunk_compress_binlog_min_interval=0,&nbsp;store_slave_file_use_link=0[2016-06-16&nbsp;19:51:04]&nbsp;INFO&nbsp;-&nbsp;file:&nbsp;storage_func.c,&nbsp;line:&nbsp;254,&nbsp;tracker_client_ip:&nbsp;10.10.10.81,&nbsp;my_server_id_str:&nbsp;10.10.10.81,&nbsp;g_server_id_in_filename:&nbsp;-771094006[2016-06-16&nbsp;19:51:04]&nbsp;INFO&nbsp;-&nbsp;file:&nbsp;tracker_client_thread.c,&nbsp;line:&nbsp;310,&nbsp;successfully&nbsp;connect&nbsp;to&nbsp;tracker&nbsp;server&nbsp;10.10.10.80:22122,&nbsp;as&nbsp;a&nbsp;tracker&nbsp;client,&nbsp;my&nbsp;ip&nbsp;is&nbsp;10.10.10.81[2016-06-16&nbsp;19:51:34]&nbsp;INFO&nbsp;-&nbsp;file:&nbsp;tracker_client_thread.c,&nbsp;line:&nbsp;1235,&nbsp;tracker&nbsp;server&nbsp;10.10.10.80:22122,&nbsp;set&nbsp;tracker&nbsp;leader:&nbsp;10.10.10.80:221221234567891012345678910</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">这里看到,创建了二级目录,成功连接到tracker。&nbsp;<br/>可以使用 fdfs_monitor 来查看一下storage的状态,看是否已经成功注册到了tracker:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/#&nbsp;fdfs_monitor&nbsp;/etc/fdfs/storage.conf&nbsp;或者: fdfs_monitor&nbsp;/etc/fdfs/client.conf(不过这个文件需要配置一下才行)123123</pre><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">[2016-06-28&nbsp;14:32:41]&nbsp;DEBUG&nbsp;-&nbsp;base_path=/data/fastdfs/storage,&nbsp;connect_timeout=30,&nbsp;network_timeout=60,&nbsp;tracker_server_count=1,&nbsp;anti_steal_token=0,&nbsp;anti_steal_secret_key&nbsp;length=0,&nbsp;use_connection_pool=0,&nbsp;g_connection_pool_max_idle_time=3600s,&nbsp;use_storage_id=0,&nbsp;storage&nbsp;server&nbsp;id&nbsp;count:&nbsp;0server_count=1,&nbsp;server_index=0tracker&nbsp;server&nbsp;is&nbsp;10.10.10.80:22122group&nbsp;count:&nbsp;1Group&nbsp;1: group&nbsp;name&nbsp;=&nbsp;group1 disk&nbsp;total&nbsp;space&nbsp;=&nbsp;7384&nbsp;MB disk&nbsp;free&nbsp;space&nbsp;=&nbsp;4306&nbsp;MB trunk&nbsp;free&nbsp;space&nbsp;=&nbsp;0&nbsp;MB storage&nbsp;server&nbsp;count&nbsp;=&nbsp;1active&nbsp;server&nbsp;count&nbsp;=&nbsp;1storage&nbsp;server&nbsp;port&nbsp;=&nbsp;23000storage&nbsp;HTTP&nbsp;port&nbsp;=&nbsp;10000store&nbsp;path&nbsp;count&nbsp;=&nbsp;1subdir&nbsp;count&nbsp;per&nbsp;path&nbsp;=&nbsp;256current&nbsp;write&nbsp;server&nbsp;index&nbsp;=&nbsp;0current&nbsp;trunk&nbsp;file&nbsp;id&nbsp;=&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Storage&nbsp;1:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;=&nbsp;10.10.10.81 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ip_addr&nbsp;=&nbsp;10.10.10.81&nbsp;&nbsp;ACTIVE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http&nbsp;domain&nbsp;=&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version&nbsp;=&nbsp;5.08 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;join&nbsp;time&nbsp;=&nbsp;2016-06-16&nbsp;20:49:05 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;up&nbsp;time&nbsp;=&nbsp;2016-06-17&nbsp;15:41:37 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;total&nbsp;storage&nbsp;=&nbsp;19211&nbsp;MB &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;。。。。。1234567891011121314151617181920212223242526272829303112345678910111213141516171819202122232425262728293031</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">看到这里显示“ACTIVE”,说明当前的storage节点已经注册到了Tracker上。</p><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">设置开机启动</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">同Tracker中的配置,把如下命令加到/etc/rc.local中:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">/usr/bin/fdfs_storaged&nbsp;/etc/fdfs/storage.conf&nbsp;restart11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">到这里storage的安装配置也完成了。当第二台节点也加进来后,可以通过日志看到如下信息:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">[2016-06-17&nbsp;15:41:46]&nbsp;INFO&nbsp;-&nbsp;file:&nbsp;storage_sync.c,&nbsp;line:&nbsp;2698,&nbsp;successfully&nbsp;connect&nbsp;to&nbsp;storage&nbsp;server&nbsp;10.10.10.82:2300011</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">【注】因为同一组的节点会进行数据同步,所以一个组内的所有storage节点会进行通信,那么这个地方就可以看出来,他们上线后会建立连接。&nbsp;<br/>另外,从端口信息上也可以看出来:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/#&nbsp;netstat&nbsp;-antp&nbsp;|&nbsp;grep&nbsp;storagetcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;0.0.0.0:23000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0:*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LISTEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;23426/fdfs_storaged tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;10.10.10.81:23000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.10.10.82:33842&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESTABLISHED&nbsp;23426/fdfs_storaged tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;10.10.10.81:50824&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.10.10.82:23000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESTABLISHED&nbsp;23426/fdfs_storaged tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;10.10.10.81:58116&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.10.10.80:22122&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESTABLISHED&nbsp;23426/fdfs_storaged1234512345</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">storage1会与storage2建立连接,同时会与tracker建立连接。</p><h2 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 2.13em; font-weight: 100;">在storage上安装配置nginx</h2><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">以下操作在storage1上完成。</p><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">安装nginx</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">上传 fastdfs-nginx-module_v1.16.tar.gz nginx-1.10.0.tar.gz pcre-8.36.tar.gz zlib-1.2.8.tar.gz 到storage服务器上的/usr/local/src 目录下</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/usr/local/src/nginx-1.10.0#&nbsp;lsauto&nbsp;&nbsp;CHANGES&nbsp;&nbsp;CHANGES.ru&nbsp;&nbsp;conf&nbsp;&nbsp;configure&nbsp;&nbsp;contrib&nbsp;&nbsp;html&nbsp;&nbsp;LICENSE&nbsp;&nbsp;Makefile&nbsp;&nbsp;man&nbsp;&nbsp;objs&nbsp;&nbsp;README&nbsp;&nbsp;src root@storage1:/usr/local/src/nginx-1.10.0#&nbsp;./configure&nbsp;–prefix=/usr/local/nginx&nbsp;–add-module=/usr/local/src/fastdfs-nginx-module-master/src&nbsp;–with-pcre=/usr/local/src/pcre-8.36&nbsp;–with-zlib=/usr/local/src/zlib-1.2.8123123</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">编译安装:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">make&nbsp;&amp;&amp;&nbsp;make&nbsp;install&nbsp;11</pre><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">配置nginx</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">修改nginx配置文件&nbsp;<br/>① 修改nginx的监听端口&nbsp;<br/>将 server 段中的 listen 端口号改为 8888:&nbsp;<br/>② 在 server 段中添加fastdfs的配置:&nbsp;<br/>这里的group[1-3] 可以匹配 group1,group2,group3,当然group也可以是其他的名字,这里正则表达式只是用来过滤请求路径。&nbsp;<br/>location ~ /group[1-3]/M00 {&nbsp;<br/>root /data/fastdfs/storage/data;&nbsp;<br/>ngx_fastdfs_module;&nbsp;<br/>}&nbsp;<br/>/data/fastdfs/storage/data 这个是指向真正存储文件的地方,该目录下有这些个二级目录</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@dtv-210:/data/fastdfs/storage/data#&nbsp;lltotal&nbsp;1048drwxr-xr-x&nbsp;259&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;27&nbsp;15:42&nbsp;./ drwxr-xr-x&nbsp;&nbsp;&nbsp;4&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;../ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;00/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;01/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;02/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;03/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;04/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;05/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;06/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;07/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;08/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;09/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;0A/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;0B/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;0C/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;0D/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;0E/ drwxr-xr-x&nbsp;258&nbsp;root&nbsp;root&nbsp;4096&nbsp;Jun&nbsp;16&nbsp;19:50&nbsp;0F/ 。。。123456789101112131415161718192021123456789101112131415161718192021</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">③将 FastDFS 的 nginx 插件模块的配置文件拷贝到 FastDFS 配置文件目录:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/usr/local/src/fastdfs-nginx-module-master/src#&nbsp;cp&nbsp;mod_fastdfs.conf&nbsp;/etc/fdfs/11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">修改 fastdfs的nginx模块的配置文件 mod_fastdfs.conf</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">base_path=/data/fastdfs/storage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#保存日志目录tracker_server=10.10.10.80:22122&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#tracker&nbsp;服务器的&nbsp;IP&nbsp;地址以及端口号storage_server_port=23000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#storage服务器的端口号group_name=group1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#当前服务器的group名url_have_group_name&nbsp;=&nbsp;true&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#文件url中是否有group&nbsp;名store_path_count=1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#存储路径个数,需要和store_path&nbsp;个数匹配store_path0=/data/fastdfs/storage&nbsp;&nbsp;&nbsp;&nbsp;#存储路径group_count&nbsp;=&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#设置组的个数#然后在末尾添加分组信息,目前只有一个分组,就只写一个[group1]group_name=group1storage_server_port=23000store_path_count=1store_path0=/data/fastdfs/storage12345678910111213141234567891011121314</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">④建立 M00 至存储目录的符号连接</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1#&nbsp;ln&nbsp;-s&nbsp;/data/fastdfs/storage/data&nbsp;/data/fastdfs/storage/data/M00root@storage1#&nbsp;ll&nbsp;/data/fastdfs/storage/data/M00lrwxrwxrwx&nbsp;1&nbsp;root&nbsp;root&nbsp;26&nbsp;Jun&nbsp;16&nbsp;19:53&nbsp;/data/fastdfs/storage/data/M00&nbsp;-&gt;&nbsp;/data/fastdfs/storage/data/123123</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">到这里,nginx和FastDFS 插件模块就配置完成了。&nbsp;<br/>⑤启动nginx&nbsp;<br/>执行/usr/local/nginx/sbin/nginx&nbsp;<br/>把上述语句加入/etc/rc.local即可开机自启动。&nbsp;<br/>可以通过netstat -unltp | grep nginx查看nginx是否起来,如果有错误,可以查看日志:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@storage1:/usr/local/nginx/logs#&nbsp;cat&nbsp;error.log&nbsp;11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">也可以访问<a style="color: rgb(12, 137, 207);" href="http://10.10.10.80:8888/" target="_blank">http://10.10.10.80:8888</a>查看nginx是否工作,看到如下界面说明nginx启动OK。&nbsp;<br/><img src="/dokuwiki/ueditor/php/upload/image/20180517/1526534917556209.png" title="1526534917556209.png" alt="20160628155849736.png"/>&nbsp;<br/>其他storage节点依照上述步骤安装与配置即可。</p><h2 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 2.13em; font-weight: 100;">安装nginx反向代理及缓存服务器</h2><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">在机器10.10.10.79上安装。</p><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">安装nginx</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">将所需的软件包上传至服务器/usr/local/src下</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server:/usr/local/src#&nbsp;tar&nbsp;zxvf&nbsp;nginx-1.10.0.tar.gz&nbsp;root@server:/usr/local/src#&nbsp;tar&nbsp;zxvf&nbsp;ngx_cache_purge-2.3.tar.gz&nbsp;root@server:/usr/local/src#&nbsp;tar&nbsp;zxvf&nbsp;pcre-8.36.tar.gz&nbsp;root@server:/usr/local/src#&nbsp;tar&nbsp;zxvf&nbsp;zlib-1.2.8.tar.gz&nbsp;root@server:/usr/local/src#&nbsp;cd&nbsp;nginx-1.10.0root@server:/usr/local/src/nginx-1.10.0#./configure&nbsp;&nbsp;–prefix=/usr/local/nginx&nbsp;&nbsp;–add-module=/usr/local/src/ngx_cache_purge-2.3&nbsp;&nbsp;–with-pcre=/usr/local/src/pcre-8.36/&nbsp;&nbsp;–with-zlib=/usr/local/src/zlib-1.2.8root@server:/usr/local/src/nginx-1.10.0#make&nbsp;&amp;&amp;&nbsp;make&nbsp;install12345671234567</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">nginx 以及 nginx cache purge 插件模块安装完毕。</p><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">配置nginx</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">①创建nginx的缓存目录</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server#&nbsp;mkdir&nbsp;-pv&nbsp;/var/cache/nginx/proxy_cache/tmp11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">②增加系统打开文件数的限制,手写到rc.local</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server#&nbsp;ulimit&nbsp;-SHn&nbsp;102400root@server#&nbsp;echo&nbsp;&quot;ulimit&nbsp;-SHn&nbsp;102400&quot;&nbsp;&gt;&gt;&nbsp;/etc/rc.local1212</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">③编辑 vim /usr/local/nginx/conf/nginx.conf 文件修改以下内容:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">user&nbsp;&nbsp;nobody;worker_processes&nbsp;&nbsp;4;error_log&nbsp;&nbsp;logs/error.log&nbsp;&nbsp;info;pid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logs/nginx.pid;events&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;worker_connections&nbsp;&nbsp;65535;&nbsp;&nbsp;&nbsp;&nbsp;use&nbsp;epoll; }http&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mime.types;&nbsp;&nbsp;&nbsp;&nbsp;default_type&nbsp;&nbsp;application/octet-stream;&nbsp;&nbsp;&nbsp;&nbsp;sendfile&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on;&nbsp;&nbsp;&nbsp;&nbsp;tcp_nopush&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on;&nbsp;&nbsp;&nbsp;&nbsp;keepalive_timeout&nbsp;&nbsp;65;&nbsp;&nbsp;&nbsp;&nbsp;server_names_hash_bucket_size&nbsp;128;&nbsp;&nbsp;&nbsp;&nbsp;client_header_buffer_size&nbsp;32k;&nbsp;&nbsp;&nbsp;&nbsp;large_client_header_buffers&nbsp;4&nbsp;32k;&nbsp;&nbsp;&nbsp;&nbsp;client_max_body_size&nbsp;300m;&nbsp;&nbsp;&nbsp;&nbsp;proxy_redirect&nbsp;off;&nbsp;&nbsp;&nbsp;&nbsp;proxy_set_header&nbsp;Host&nbsp;$http_host;&nbsp;&nbsp;&nbsp;&nbsp;proxy_set_header&nbsp;X-Real-IP&nbsp;$remote_addr;&nbsp;&nbsp;&nbsp;&nbsp;proxy_set_header&nbsp;X-Forwarded-For&nbsp;$proxy_add_x_forwarded_for;&nbsp;&nbsp;&nbsp;&nbsp;proxy_connect_timeout&nbsp;90;&nbsp;&nbsp;&nbsp;&nbsp;proxy_send_timeout&nbsp;90;&nbsp;&nbsp;&nbsp;&nbsp;proxy_read_timeout&nbsp;90;&nbsp;&nbsp;&nbsp;&nbsp;proxy_buffer_size&nbsp;16k;&nbsp;&nbsp;&nbsp;&nbsp;proxy_buffers&nbsp;4&nbsp;64k;&nbsp;&nbsp;&nbsp;&nbsp;proxy_busy_buffers_size&nbsp;128k;&nbsp;&nbsp;&nbsp;&nbsp;proxy_temp_file_write_size&nbsp;128k;&nbsp;&nbsp;&nbsp;&nbsp;#设置缓存存储路径、存储方式、分配内存大小、磁盘最大空间、缓存期限 &nbsp;&nbsp;&nbsp;&nbsp;proxy_cache_path&nbsp;&nbsp;/var/cache/nginx/proxy_cache&nbsp;&nbsp;levels=1:2 &nbsp;&nbsp;&nbsp;&nbsp;keys_zone=http-cache:500m&nbsp;max_size=10g&nbsp;inactive=30d;&nbsp;&nbsp;&nbsp;&nbsp;proxy_temp_path&nbsp;/var/cache/nginx/proxy_cache/tmp;&nbsp;&nbsp;&nbsp;&nbsp;#设置&nbsp;group1&nbsp;的服务器 &nbsp;&nbsp;&nbsp;&nbsp;upstream&nbsp;fdfs_group1&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;10.10.10.80:8888&nbsp;weight=1&nbsp;max_fails=2&nbsp;fail_timeout=30s;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;10.10.10.81:8888&nbsp;weight=1&nbsp;max_fails=2&nbsp;fail_timeout=30s; &nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;log_format&nbsp;&nbsp;main&nbsp;&nbsp;&#39;$remote_addr&nbsp;-&nbsp;$remote_user&nbsp;[$time_local]&nbsp;&quot;$request&quot;&nbsp;&#39; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;$status&nbsp;$body_bytes_sent&nbsp;&quot;$http_referer&quot;&nbsp;&#39; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;&quot;$http_user_agent&quot;&nbsp;&quot;$http_x_forwarded_for&quot;&#39;;&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;80;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server_name&nbsp;&nbsp;localhost;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;access_log&nbsp;&nbsp;logs/host.access.log&nbsp;&nbsp;main;&nbsp;&nbsp;&nbsp;&nbsp;#设置&nbsp;group1&nbsp;的反向代理参数 &nbsp;&nbsp;&nbsp;&nbsp;location&nbsp;/group1/M00&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_next_upstream&nbsp;http_502&nbsp;http_504&nbsp;error&nbsp;timeout&nbsp;invalid_header;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_cache&nbsp;http-cache;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_cache_valid&nbsp;200&nbsp;304&nbsp;12h;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_cache_key&nbsp;$uri$is_args$args;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_pass&nbsp;http://fdfs_group1;        expires 30d; &nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;#设置清除缓存的访问权限 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location&nbsp;~&nbsp;/purge(/.*)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;allow&nbsp;127.0.0.1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;allow&nbsp;10.10.10.0/24;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deny&nbsp;all;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_cache_purge&nbsp;http-cache&nbsp;$1$is_args$args; &nbsp;&nbsp;&nbsp;&nbsp;}&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;} }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">接下来,可以使用 /usr/local/nginx/sbin/nginx -t 来测试配置文件语法的正确性。</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server:/usr/local/nginx#&nbsp;./sbin/nginx&nbsp;-tngx_http_fastdfs_set&nbsp;pid=5895nginx:&nbsp;the&nbsp;configuration&nbsp;file&nbsp;/usr/local/nginx/conf/nginx.conf&nbsp;syntax&nbsp;is&nbsp;oknginx:&nbsp;configuration&nbsp;file&nbsp;/usr/local/nginx/conf/nginx.conf&nbsp;test&nbsp;is&nbsp;successful root@server:/usr/local/nginx#&nbsp;1234512345</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">④启动nginx并加入到开机启动</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">/usr/local/nginx/sbin/nginx11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">把/usr/local/nginx/sbin/nginx加入/etc/rc.local即可。&nbsp;<br/>同样可以查看端口看是否正常启动:</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">netstat&nbsp;-unltp&nbsp;|&nbsp;grep&nbsp;nginx11</pre><h2 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 2.13em; font-weight: 100;">测试上传文件</h2><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">以下操作在tracker服务器(10.10.10.80)上进行&nbsp;<br/>①创建client 使用的日志目录</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server#&nbsp;mkdir&nbsp;-pv&nbsp;/data/fastdfs/client11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">②修改客户端的配置文件/etc/fdfs/client.conf</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">base_path=/data/fastdfs/client&nbsp;#日志存放路径tracker_server=10.10.10.80:22122&nbsp;#tracker&nbsp;服务器&nbsp;IP&nbsp;地址和端口号http.tracker_server_port=8888123123</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">③上传一个图片</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server#&nbsp;fdfs_upload_file&nbsp;/etc/fdfs/client.conf&nbsp;1.jpggroup1/M00/00/00/CgoKeFRQqaaASddNAxEgRsu1UiU345.jpg root@server#123123</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">得到了如下的地址:&nbsp;<br/>group1/M00/00/00/CgoKeFRQqaaASddNAxEgRsu1UiU345.jpg&nbsp;<br/>还可以通过fdfs_file_info 来查看上传文件的信息</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server#&nbsp;fdfs_file_info&nbsp;/etc/fdfs/client.conf&nbsp;11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">通过浏览器访问:&nbsp;<br/>④使用浏览器访问一下该地址:&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="http://10.10.10.79/group1/M00/00/00/CgoKeFRQqaaASddNAxEgRsu1UiU345.jpg" target="_blank">http://10.10.10.79/group1/M00/00/00/CgoKeFRQqaaASddNAxEgRsu1UiU345.jpg</a>&nbsp;<br/>即可成功访问到图片。&nbsp;<br/>⑤查看nginx的缓存目录,可以查看缓存的内容。</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">root@server#&nbsp;ll&nbsp;-R&nbsp;/var/cache/nginx/proxy_cache/&nbsp;11</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">⑥清除缓存&nbsp;<br/>如果清除该图片的缓存,可以在文件 URL 之前加上 purge 即可,如下图&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="http://10.10.10.79/purge/group1/M00/00/00/CgoKeFRQqaaASddNAxEgRsu1UiU345.jpg" target="_blank">http://10.10.10.79/purge/group1/M00/00/00/CgoKeFRQqaaASddNAxEgRsu1UiU345.jpg</a>&nbsp;<br/>清除之后,当storage中文件被删除后,将无法再请求到文件。&nbsp;<br/>⑦配置浏览器端查看是否命中缓存&nbsp;<br/>使用Chrome浏览器的开发工具,查看响应的头部信息来查看是否命中缓存,要启用此功能,修改nginx的主配置文件如下:&nbsp;<br/>在location /group1/M00 段增加这2个行</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">add_header&nbsp;&nbsp;X-Via&nbsp;&nbsp;$server_addr; add_header&nbsp;&nbsp;X-Cache-Status&nbsp;$upstream_cache_status;1212</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">最终效果</p><pre class="prettyprint" style="padding: 5px 5px 5px 60px; border-radius: 0px; border: 0px solid rgb(136, 136, 136); border-image: none; color: rgb(51, 51, 51); line-height: 1.45; font-family: &quot;Source Code Pro&quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1.1em; white-space: nowrap; position: relative; -ms-word-break: break-all; -ms-overflow-x: auto; -ms-overflow-y: hidden; -ms-word-wrap: break-word; box-sizing: border-box; background-color: rgba(128, 128, 128, 0.047058);">location&nbsp;/group1/M00&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;proxy_next_upstream&nbsp;http_502&nbsp;http_504&nbsp;error&nbsp;timeout&nbsp;invalid_header; &nbsp;&nbsp;&nbsp;&nbsp;proxy_cache&nbsp;http-cache; &nbsp;&nbsp;&nbsp;&nbsp;proxy_cache_valid&nbsp;200&nbsp;304&nbsp;12h; &nbsp;&nbsp;&nbsp;&nbsp;proxy_cache_key&nbsp;$uri$is_args$args; &nbsp;&nbsp;&nbsp;&nbsp;proxy_pass&nbsp;http://fdfs_group1; &nbsp;&nbsp;&nbsp;&nbsp;expires&nbsp;30d; &nbsp;&nbsp;&nbsp;&nbsp;add_header&nbsp;&nbsp;X-Via&nbsp;&nbsp;$server_addr; &nbsp;&nbsp;&nbsp;&nbsp;add_header&nbsp;&nbsp;X-Cache-Status&nbsp;$upstream_cache_status; }1234567891012345678910</pre><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">重启nginx,清除缓存再次访问即可查看响应头命中信息。</p><h3 style="margin: 0.8em 0px; padding: 0px; color: rgb(63, 63, 63); line-height: 1.3em; font-family: &quot;microsoft yahei&quot;; font-size: 1.73em; font-weight: 100;">附录</h3><p style="color: rgb(63, 63, 63); padding-top: 0px; padding-bottom: 0px; font-family: &quot;microsoft yahei&quot;; font-size: 15px; margin-top: 0px; margin-bottom: 1.1em;">需要再多写一点, FastDFS这样部署就已经可以正常运行了,但是有一个问题,就是FastDFS本身不支持对上传的文件去重。也就是说,同一个文件,我们反复上传,那么会在Storage中保存多份,这显然是不合理的。解决办法,需要的请参考我另一篇文章:&nbsp;<br/>《FastDHT配合FastDFS进行文件上传去重》&nbsp;<br/><a style="color: rgb(12, 137, 207);" href="http://blog.csdn.net/ForeverSunshine/article/details/51226061" target="_blank">http://blog.csdn.net/ForeverSunshine/article/details/51226061</a></p>