ubuntu18离线安装nginx+fastdfs

 

环境

ubuntu版本:18.04-server

------------------------------

下载如下软件包:

autoconf-latest.tar.gz

automake-1.15.tar.gz

fastdfs-5.11.tar.gz

fastdfs-nginx-module-1.20.tar.gz

libfastcommon-1.0.38.tar.gz

m4-1.4.18.tar.gz

openssl-1.1.0j.tar.gz

pcre-8.40.tar.gz

zlib-1.2.11.tar.gz

--------------------------------

1.安装libfastcommon

tar -zxvf libfastcommon-1.0.38.tar.gz
cd libfastcommon-1.0.38
./make.sh
./make.sh install

2安装fastdfs

tar -zxvf fastdfs-5.11.tar.gz
cd fastdfs-5.11
./make.sh
./make.sh install

3配置tracker服务

mkdir -p /root/fastdfs/tracker
cd /etc/fdfs/
cp tracker.conf.sample tracker.conf
vi tracker.conf




base_path=/root/fastdfs/tracker
#其他根据需要修改

启动:fdfs_trackerd /etc/fdfs/tracker.conf start

查看端口情况:netstat -apn|grep fdfs

4配置storage服务

mkdir -p /root/fastdfs/storage
cd /etc/fdfs/
cp storage.conf.sample storage.conf
vi storage.conf



base_path=/root/fastdfs/storage
store_path0=/root/fastdfs/storage
tracker_server=<本机ip>:22122
#其他配置项根据现实情况来

 

启动:fdfs_storaged /etc/fdfs/storage.conf

查看端口情况:netstat -apn|grep fdfs

通过monitor来查看storage是否成功绑定

fdfs_monitor /etc/fdfs/storage.conf

ubuntu18离线安装nginx+fastdfs_第1张图片

5安装nginx和fastdfs-nginx-module模块

先安装依赖包

tar -zxvf m4-1.4.18.tar.gz 
cd m4-1.4.18/
./configure 
make
make install

tar -zxvf autoconf-latest.tar.gz 
cd cd autoconf-2.69
./configure 
make
make install

tar -zxvf automake-1.15.tar.gz 
cd automake-1.15
./configure 
make
make install

tar -zxvf openssl-1.1.0j.tar.gz 
cd openssl-1.1.0j
./config
make
make install

tar -zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure 
make
make install

tar -zxvf zlib-1.2.11.tar.gz 
cd zlib-1.2.11/
./configure 
make
make install

安装fastdfs-nginx-module模块

tar -zxvf fastdfs-nginx-module-1.20.tar.gz
mv fastdfs-nginx-module-1.20 /usr/local/src/

修改fastdfs-nginx-module-1.20/src/config文件:

/usr/local/src/fastdfs-nginx-module-1.20/src
vi config


ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

安装nginx

tar -zxvf nginx-1.15.2.tar.gz 
cd nginx-1.15.2/
./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module-1.20/src/
make
make install

启动nginx

cd /usr/local/nginx/sbin/
./nginx

配置mod-fastdfs.conf,并拷贝到/etc/fdfs文件目录下

cd /usr/local/src/fastdfs-nginx-module-1.20/src/
cp mod_fastdfs.conf /etc/fdfs

进入/etc/fdfs修改mod-fastdfs.conf:

cd /etc/fdfs/
vi mod_fastdfs.conf 



base_path=/root/fastdfs
tracker_server=<本地ip>:22122
url_have_group_name = true
store_path0=/root/fastdfs/storage

配置nginx,8888端口server增加location:
 

使用root启动

配置文件中修改

user  root;
cd /usr/local/nginx/conf/
vi nginx.conf


location ~/group1/M00{
	root /root/fastdfs/storage/data;
	ngx_fastdfs_module;
}

cat  ubuntu18离线安装nginx+fastdfs_第2张图片

最后需要拷贝fastdfs解压目录中的http.conf和mime.types

cd /opt/fastdfs/fastdfs-5.11/conf
cp mime.types http.conf /etc/fdfs/
cp /usr/local/src/fastdfs-nginx-module-1.20/src/mod_fastdfs.conf /etc/fdfs/

重新启动nginx

cd /usr/local/nginx/sbin
./nginx -s reload 

 

你可能感兴趣的:(运维,fastdfs,nginx)