【正文】
} proxy the PHP scripts to Apache listening on :80 location ~ \.php$ { proxy_pass 。 proxy_set_header XForwardedFor $proxy_add_x_forwarded_for。 access_log logs/ main。 反向代理 start upstream fdfs_group1 { server :80。$status $body_bytes_sent $_referer 39。error_log logs/ info。 解壓解壓軟件包到自定義目錄,這里,解壓到/software目錄。如下圖: 配置libfastmonFastDFS主程序設(shè)置的lib目錄是:/usr/local/lib所以應(yīng)該創(chuàng)建軟鏈接到這里,執(zhí)行下面的命令:ln s /usr/lib64/ /usr/local/lib/ln s /usr/lib64/ /usr/lib/ln s /usr/lib64/ /usr/lib/ln s /usr/lib64/ /usr/local/lib/ 安裝FastDFS在所有的tracker和storage服務(wù)器上都要安裝FastDFS。base_path=/home/fastdfs_files/tracker max concurrent connections this server supportedmax_connections=256 accept thread count default value is 1 since accept_threads=1 work thread count, should = max_connections default value is 4 since work_threads=4 the method of selecting group to upload files 0: round robin 1: specify group 2: load balance, select the max free space group to upload filestore_lookup=2 which group to upload file when store_lookup set to 1, must set store_group to the group namestore_group=group2 which storage server to upload file 0: round robin (default) 1: the first server order by ip address 2: the first server order by priority (the minimal)store_server=0 which path(means disk or mount point) of the storage server to upload file 0: round robin 2: load balance, select the max free space path to upload filestore_path=0 which storage server to download file 0: round robin (default) 1: the source storage server which the current file uploaded todownload_server=0 reserved storage space for system or other applications. if the free(available) space of any stoarge server in a group = reserved_storage_space, no file can be uploaded to this group. bytes unit can be one of follows: G or g for gigabyte(GB) M or m for megabyte(MB) K or k for kilobyte(KB) no unit for byte(B) % as ratio such as reserved_storage_space = 10%reserved_storage_space = 10%standard log level as syslog, case insensitive, value list: emerg for emergency alert crit for critical error warn for warning notice info debuglog_level=infounix group name to run this program, not set (empty) means run by the group of current userrun_by_group=unix username to run this program,not set (empty) means run by current userrun_by_user= allow_hosts can ocur more than once, host can be hostname or ip address, * means match all ip addresses, can use range like this: .[115,20] or host[0108,2025]., for example: allow_hosts=.[115,20] allow_hosts=host[0108,2025].allow_hosts=* sync log buff to disk every interval seconds default value is 10 secondssync_log_buff_interval = 10 check storage server alive interval secondscheck_active_interval = 120 thread stack size, should = 64KB default value is 64KBthread_stack_size = 64KB auto adjust when the ip address of the storage server changed default value is truestorage_ip_changed_auto_adjust = true storage sync file max delay seconds default value is 86400 seconds (one day) since storage_sync_file_max_delay = 86400 the max time of storage sync a file default value is 300 seconds since storage_sync_file_max_time = 300 if use a trunk file to store several small files default value is false since use_trunk_file = false the min slot size, should = 4KB default value is 256 bytes since slot_min_size = 256 the max slot size, should slot_min_size store the upload file to trunk file when it39。group_count = 2 group settings for group 1 since when support multigroup, unment following section 設(shè)置每組的組名,端口號(hào),數(shù)據(jù)文件路徑[group1]group_name=group1storage_server_port=23000store_path_count=1store_path0=/home/fastdfs_files/storage_datastore_path1=/home/yuqing/fastdfs1 group settings for group 2 since when support multigroup, unment following section as neccessary[group2]group_name=group2storage_server_port=23000store_path_count=1store_path0=/home/fastdfs_files/storage/storage_data將這個(gè)文件復(fù)制到/etc/fdfs 目錄中:cd /usr/local/fastdfsnginxmodule/src/cp /etc/fdfs/ config文件修改config文件:vi /usr/local/fastdfsnginxmodule/src/config只需修改第4行,修改如下:CORE_INCS=$CORE_INCS /usr/include/fastdfs /usr/include/fastmon 安裝Nginx注意:需要在每個(gè)storage上都安裝nginx模塊,因?yàn)槟J(rèn)是沒有暴露協(xié)議的,所以在每個(gè)的storage上都需要安裝nginx來(lái)支持其協(xié)議的訪問。} { include 。 access_log logs/ main。 server :80。 } 配置當(dāng)前storage服務(wù)器M00段的location聲明,注意: root 后面的目錄應(yīng)根據(jù)實(shí)際配置的目錄修改 location /group1/M00 { root /home/fastdfs_files/storage。 proxy_set_header XRealIP $remote_addr。 fastcgi_index 。 server_name somename alias 。 ssl_session_timeout 5m。sudo fdfs_trackerd /etc/fdfs/ restart sudo fdfs_monitor /etc/fdfs/ sudo /usr/local/nginx/sbin/nginx index 。 server_name localhost。s document root concurs with nginx39。 location = / { root html。 proxy_set_header XRealIP