Home > Article > Backend Development > Q&A collection of cluster configuration questions about fastDFS+nginx
Xiao An won’t go into detail here about how to configure fastDFS+nginx. There are tutorials on the Internet. Although they are not perfect, everyone can probably configure this framework.
For everyone’s needs, I still found a detailed tutorial and share the link as follows:
http://pan.baidu.com/s/1i3D6wPR
The following is my Xiao An My personal experience during the configuration process has been made into a Q&A for reference. Any similarity is purely coincidental, haha.
First, I will write two basic operations:
fastDFS opening:
Open tracker:
/usr/bin/fdfs_trackerd /home/an/work/fastDFS/TLOGS/conf/tracker. conf restart
Enable storage:
/usr/bin/fdfs_storaged /home/an/work/fastDFS/SLOGS/conf/storage.conf restart
Upload files:
fdfs_upload_file /home/an/work/fastDFS/CLOGS /conf/client.conf /home/an/work/fastDFS/CLOGS/conf/1.jpg
(Note: Change the path to the actual path you installed in your own system!!)
Also Remember to use root privileges~
If you need to change the configuration file but are not proficient in the basic vi function gedit, then remember to modify the folder permissions:
chmod -R 777 [filename]
View port Situation:
netstat -unltp | grep fdfs
fastDFS If it cannot start normally, please check whether the dependency package is complete
This is the dependency package required by nginx: wget http://fastdfs.googlecode. com/files/fastdfs-nginx-module_v1.15.tar.gz
The following is Xiaoan’s Q&A session:
1,
Q: After installing fastDFS but not installing nginx, you can upload images, but It is not possible to access images through the browser through the returned URL
A:The latest version of fastDFS no longer supports HTTP access service. It can only be said that the tutorial you are watching is too old and must be used with other servers. Access is available.
2,
Q: What should I do if I keep getting errors after installing nginx and modifying nginx.conf? (This question applies to various situations)
A: This is largely because your nginx does not configure related modules. At this time you have to ask: How can I add the module to nginx after it has been installed? Haha, hum, there is no way to force it in. So my friend, recompile!
There are many commands for configuring modules on the Internet, but I went to foreign official websites to find the most complete one:
First, enter the directory where the nginx installation folder is located, delete make.sh, and then run The following commands
./configure --prefix=/etc/nginx
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error- log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
- -lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/nginx/ proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path= /var/cache/nginx/scgi_temp
--user=nginx
--group=nginx
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure _link_module
--with-http_stub_status_module
- -with-http_auth_request_module
--with-mail
--with-mail_ssl_module
--with-file-aio
--with-http_spdy_module
--with-ipv6
--add-module=/home/an/work/ etc/fastdfs-nginx-module/src
--add-module=/home/an/work/etc/ngx_cache_purge
--with-pcre=/home/an/work/etc/pcre-8.34
--with- zlib=/home/an/work/etc/zlib-1.2.7
Here please pay attention to adjusting the directory to your own directory and the components related to the last four commands: fastdfs-nginx-module || ngx_cache_purge | | pcre-8.34 || zlib-1.2.7 If you don’t have it, download it online. Remember to install pcre-8.34 before running the command || These two components of zlib-1.2.7 (enter the folder make+make install)
After running the command, enter the command make to compile, and then add the previously installed nginx configuration file *.conf to yourself After backing up (back up whatever has been changed) run make install.
(In fact, it saves trouble. You can also copy and replace the nginx binary file. If you still don’t understand, you can search for “nginx upgrade”)
3,
Q: ERROR: nginx: [emerg ] getpwnam("**") failed
A: There are also relevant answers on this website, for example: sudo adduser --system --no-create-home --disabled-password --group nginx
.
My solution is: remove the # comment in front of "#user [nobody];" in nginx.conf and change it to "user root;" (this will fundamentally solve the problem!)4,
Q: ERROR: open() "/var/run/nginx.pid" failed (2: No such file or directory)
A: This is a common problem, no nonsense : nginx -c /etc/nginx/nginx.conf to solve the problem (please fill in your correct directory)
5,
Q:ERROR:include file "http.conf" not exists, line: "# include http.conf"
A: Find the mod_fastdfs.conf file (if not found, go to the root directory find -name) and find: #include http.conf Just add "#" in front of this
6,
Q:ERROR: host "tracker" is invalid
A: If this is the case, there is still an item in the mod_fastdfs.conf file that is tracker_server=****. The default display is tracker_server = tracker. It should be that the tracker at the back is not replaced with the ip:port of the actual tracker.
Xiaoan suggests that you change the port number of store_path0=.... at the back.
Q: ERROR: unknown directive "proxy_cache_purge"
A: nginx is missing the
proxy_cache_purge module, don't doubt it, just follow Xiao An's second Q&A above to solve it.
8 ? Search!) Find the path where
http.mime_types_filename=
http.anti_steal.token_check_fail=
to the actual mime.types and anti-steal.jpg
If If you say you can’t find it or it’s useless to change it, then delete Xiaoan and think it doesn’t hurt.
There is also another one, don’t forget during installation
ln -s /home/an /work/fastDFS/SP0/data /home/an/work/fastDFS/SP0/data/M00 (change to actual path)
That’s all the big obstacles I encountered Yes, if you have any small problems, you can figure it out by yourself. Hehe, attached is the completed rendering:
Copyright statement: This article is an original article by the blogger and has not been published by the blogger. No reproduction allowed with permission of the owner.
The above introduces the Q&A collection of cluster configuration questions about fastDFS+nginx, including relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.