#给启动脚本增加权限
chmod 777 /etc/init.d/nginxd
#启动nginx
service nginxd restart
#启动成功,加入开机启动
vim /etc/rc.d/rc.local
#加入内容如下
service nginxd start 8. 安装nginx-module模块(仅Storage)
1> wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.15.tar.gz
2> tar -zxvf fastdfs-nginx-module_v1.15.tar.gz;
#修改插件配置文件
vim /usr/local/src/fastdfs-nginx-module/src/config
#修改内容如下
ngx_addon_name=ngx_http_fastdfs_module
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/local/fastdfs/include/fastdfs /usr/local/fastdfs/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/local/fastdfs/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/usr/local/fastdfs/conf/mod_fastdfs.conf\"'"
#复制mod_fastdfs.conf到/usr/local/fastdfs/conf/目录下
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /usr/local/fastdfs/conf/
#将/usr/local/fastdfs/lib 加入系统文件/etc/ld.so.conf中(编译时使用的动态链接库)
vim /etc/ld.so.conf
#修改内容如下
/usr/local/fastdfs/lib
#更新库文件缓存ld.so.cache
/sbin/ldconfig
#编译fastdfs-nginx-module模块
1> cd nginx-1.1.19/
2> ./configure 此处加上nginx之前的编译参数(使用 /usr/local/nginx/sbin/nginx -V 命令查看) --add-module=/usr/local/src/fastdfs-nginx-module/src
3> make && make install
#修改mod_fastdfs.conf配置
vim /usr/local/fastdfs/conf/mod_fastdfs.conf
#修改内容如下
# if load FastDFS parameters from tracker server
# since V1.12
# default value is false
load_fdfs_parameters_from_tracker=true
# FastDFS tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
# valid only when load_fdfs_parameters_from_tracker is true
tracker_server=192.168.25.11:22122
# the port of the local storage server
# the default value is 23000
storage_server_port=23000
# the group name of the local storage server
group_name=group1 #当前storage机器组名
# if the url / uri including the group name
# set to false when uri like /M00/00/00/xxx
# set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
# default value is false
url_have_group_name = true
# path(disk or mount point) count, default value is 1
# must same as storage.conf
store_path_count=1
# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
# must same as storage.conf
store_path0=/home/fastdfs/storage
# set the log filename, such as /usr/local/apache2/logs/mod_fastdfs.log
# empty for output to stderr (apache and nginx error_log file)
log_filename=/home/www/logs/mod_fastdfs.log