Home Backend Development PHP Tutorial Q&A collection of cluster configuration questions about fastDFS+nginx

Q&A collection of cluster configuration questions about fastDFS+nginx

Jul 29, 2016 am 09:16 AM
fastdfs http module nginx with

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 of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to allow external network access to tomcat server How to allow external network access to tomcat server Apr 21, 2024 am 07:22 AM

To allow the Tomcat server to access the external network, you need to: modify the Tomcat configuration file to allow external connections. Add a firewall rule to allow access to the Tomcat server port. Create a DNS record pointing the domain name to the Tomcat server public IP. Optional: Use a reverse proxy to improve security and performance. Optional: Set up HTTPS for increased security.

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

How to deploy nodejs project to server How to deploy nodejs project to server Apr 21, 2024 am 04:40 AM

Server deployment steps for a Node.js project: Prepare the deployment environment: obtain server access, install Node.js, set up a Git repository. Build the application: Use npm run build to generate deployable code and dependencies. Upload code to the server: via Git or File Transfer Protocol. Install dependencies: SSH into the server and use npm install to install application dependencies. Start the application: Use a command such as node index.js to start the application, or use a process manager such as pm2. Configure a reverse proxy (optional): Use a reverse proxy such as Nginx or Apache to route traffic to your application

Welcome to nginx!How to solve it? Welcome to nginx!How to solve it? Apr 17, 2024 am 05:12 AM

To solve the "Welcome to nginx!" error, you need to check the virtual host configuration, enable the virtual host, reload Nginx, if the virtual host configuration file cannot be found, create a default page and reload Nginx, then the error message will disappear and the website will be normal show.

How to communicate between docker containers How to communicate between docker containers Apr 07, 2024 pm 06:24 PM

There are five methods for container communication in the Docker environment: shared network, Docker Compose, network proxy, shared volume, and message queue. Depending on your isolation and security needs, choose the most appropriate communication method, such as leveraging Docker Compose to simplify connections or using a network proxy to increase isolation.

How to generate URL from html file How to generate URL from html file Apr 21, 2024 pm 12:57 PM

Converting an HTML file to a URL requires a web server, which involves the following steps: Obtain a web server. Set up a web server. Upload HTML file. Create a domain name. Route the request.

How to implement HTTP streaming using C++? How to implement HTTP streaming using C++? May 31, 2024 am 11:06 AM

How to implement HTTP streaming in C++? Create an SSL stream socket using Boost.Asio and the asiohttps client library. Connect to the server and send an HTTP request. Receive HTTP response headers and print them. Receives the HTTP response body and prints it.

What are the most common instructions in a dockerfile What are the most common instructions in a dockerfile Apr 07, 2024 pm 07:21 PM

The most commonly used instructions in Dockerfile are: FROM: Create a new image or derive a new image RUN: Execute commands (install software, configure the system) COPY: Copy local files to the image ADD: Similar to COPY, it can automatically decompress tar archives or obtain URL files CMD: Specify the command when the container starts EXPOSE: Declare the container listening port (but not public) ENV: Set the environment variable VOLUME: Mount the host directory or anonymous volume WORKDIR: Set the working directory in the container ENTRYPOINT: Specify what to execute when the container starts Executable file (similar to CMD, but cannot be overwritten)

See all articles