In the front we have configured the FASTDFS environment, but at this time the Fastdfs can not be accessed through HTTP, the previous version of the FASTDFS is integrated with the HTTP server function, so I see some of the earlier blog in the configuration of the time to consider the HTTP server , I also configured according to their method, but the error is all-out, and later found that I use the fastdfs_v4.06 is required to configure the Apache server separately, the following is my configuration process.
I. Environmental statement
I use VirtualBox on the WINDOWS10 64-bit system to virtual an Ubuntu 14.04 LTS 64-bit virtual machine, in the previous blog has been built Fastdfs. Fastdfs installed version is fastdfs_v4.06, and the use of a single-node installation, virtual machine using the Network Bridge network card mode, IP address is 211.87.226.134. All of the following commands are executed under the root user.
II. installation of Apache and related software packages
Execute the following command to install Apache already related software, remember not to install only apache2, or in the back of the configuration will appear some files can not find the situation.
apt-get install apache2 apt-get install apache2.2-bin apt-get install apache2-utils apt-get install apache2-mpm-prefork apt-get install libapache2-mod-php5 apt-get install apache2-prefork-dev
Three, installation configuration Fastdfs-apache-module
1. Execute the following command to download:
wget https://fastdfs.googlecode.com/files/fastdfs-apache-module_v1.15.tar.gz
2. Unzip and modify the makefile file
tar zxvf fastdfs-apache-module_v1.15.tar.gzcd fastdfs-apache-module/srcgedit Makefile
3, modify the values of the following variables, if your Apache is installed by default, then you can use the following directory, if not please follow your own configuration to modify.
APACHE_BASE_PATH=/usr/share/apache2/APXS=/usr/bin/apxs2APACHECTL=/usr/bin/apachectl
4. Installation
makemake install
5, Configuration Apache2
Create a Mod_fastdfs.load file and add part of the content
gedit /etc/apache2/mods-available/mod_fastdfs.load
Add the following content to this file:
LoadModule fastdfs_module /usr/lib/apache2/modules/mod_fastdfs.so<Location /M00> sethandler fastdfs</Location>
Execute the following command to load the mod_fastdfs.so module
a2enmod mod_fastdfs
Modify the virtual host configuration, modify the relevant variable values, add the alias row configuration
gedit /etc/apache2/sites-enabled/000-default
Add the following to the file:
DocumentRoot /opt/fdfs/data/<Directory /opt/fdfs/data/>alias /group1/M00 /opt/fdfs/data
Modifying the mod_fastdfs.conf configuration
gedit /etc/fdfs/mod_fastdfs.conf
Make the following changes according to your actual situation
base_path=/home/xing/fastdfstracker_server=211.87.226.134:22122store_path0=/home/xing/fastdfs
Restart Apache to make configuration effective
/etc/init.d/apache2 restart
Iv. Testing
FASTDFS installation package, with the client program, through the program can upload files. Before using this client program, you need to configure client.conf before uploading and downloading files.
Modify the%fastdfs%/conf/client.conf file and modify the following:
Customizable, but this directory must be present to hold file upload log
base_path=/home/xing/fastdfstracker_server=211.87.226.134.121:22122
Use the following command to upload a file
fdfs_test %FastDFS%/conf/client.conf upload test.txt
The following message is returned when the upload is successful:
We enter in the browser of this machine: http://211.87.226.134/M00/00/00/01fihlag0FiAGaE5AAAAEv-uAfI775_ Big.txt to access this file will show the following results, note that the address here is not the return file URL, but the IP address plus remote_filename.
The contents of the file are displayed, here is the Chinese garbled, after I set up again.
Distributed File Storage Fastdfs (quad) configuration Fastdfs-apache-module