fastdfs nginx安装与配置
时间: 2024-01-09 16:05:00 浏览: 113
好的,针对您的问题:fastdfs nginx安装与配置,我可以给出以下步骤:
1. 安装FastDFS
```
# 下载FastDFS
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz
# 解压
tar -zxvf V1.0.43.tar.gz
tar -zxvf V6.06.tar.gz
# 编译安装libfastcommon
cd libfastcommon-1.0.43/
./make.sh && ./make.sh install
# 编译安装FastDFS
cd ../fastdfs-6.06/
./make.sh && ./make.sh install
# 配置tracker和storage
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
```
2. 配置FastDFS
修改`/etc/fdfs/tracker.conf`和`/etc/fdfs/storage.conf`文件中的以下内容:
```
# tracker.conf
...
port=22122 # Tracker服务器的端口号
...
# storage.conf
...
port=23000 # Storage服务器的端口号
base_path=/data/fastdfs/storage # 文件存储路径
store_path0=/data/fastdfs/storage/data # 数据存储路径
tracker_server=192.168.1.1:22122 # Tracker服务器的IP和端口号
http.server_port=8888 # 文件访问的HTTP端口号
...
```
3. 启动FastDFS
```
# 启动Tracker服务器
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
# 启动Storage服务器
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
```
4. 安装Nginx和FastDFS模块
```
# 安装Nginx
yum install -y nginx
# 安装FastDFS模块
git clone https://github.com/happyfish100/fastdfs-nginx-module.git
mv fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
mv fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
# 编译安装Nginx(需要指定FastDFS模块)
./configure --add-module=/path/to/fastdfs-nginx-module/src
make && make install
```
5. 配置Nginx
修改`/usr/local/nginx/conf/nginx.conf`文件:
```
http {
...
server {
listen 80;
server_name localhost;
location /group1/M00 {
ngx_fastdfs_module;
}
}
}
```
6. 启动Nginx
```
/usr/local/nginx/sbin/nginx
```
阅读全文