search
HomeBackend DevelopmentPHP TutorialQ&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.

7,

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.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software