Linux 스 크 립 트 원 키 설치 설정 Nginx + FastDFS

환경 준비
yum -y update && yum -y install cmake make gcc gcc-c++ openssl-devel vim wget
서류 준비
/ usr / local / software 디 렉 터 리 에 다음 파일 을 준비 합 니 다.
다운로드 주소:https://github.com/AlEinstein/install_package/tree/master/linux/nginx%2Bfastdfs
1001.png fastdfs-5.11.tar.gz fastdfs-nginx-module_v1.16.tar.gz libfastcommon-1.0.38.tar.gz nginx-1.6.2.tar.gz nginx_fastdfs.sh
3. 스 크 립 트 처리
cd /usr/local/software
chmod +x nginx_fastdfs.sh
sed -i "s/\r$//" nginx_fastdfs.sh

nginx_fastdfs. sh 스 크 립 트 에 설 치 된 ip: 192.168.0.130 8083, 포트: 8083, 자신의 요구 에 따라 스 크 립 트 를 수정 하면 됩 니 다.
예 를 들 어 설 치 된 ip 호스트 주 소 는 172.2.2.23.11 이 고 포트 8088 이면 교체 명령 을 실행 합 니 다.
sed -i "s#192.168.0.130#172.20.23.11#g" /usr/local/software/nginx_fastdfs.sh
sed -i "s#8083#8088#g" /usr/local/software/nginx_fastdfs.sh

4. 스 크 립 트 설치
./nginx_fastdfs.sh > logs01 

스 크 립 트 가 실 행 된 후 브 라 우 저 로 로그 파일 에 접근 합 니 다. logs01 아래 URL, 접근 할 수 있 으 면 설치 완료
스 크 립 트 주소:https://github.com/AlEinstein/install_package/blob/master/linux/nginx%2Bfastdfs/nginx_fastdfs.sh
#!/bin/bash
## https://me.csdn.net/qq262593421

##      fdfs
## /usr/bin/fdfs_trackerd  /etc/fdfs/tracker.conf  restart
## /usr/bin/fdfs_storaged  /etc/fdfs/storage.conf  restart
## /usr/local/nginx/sbin/nginx -s reload
## /usr/bin/fdfs_test /etc/fdfs/client.conf upload /usr/local/software/1001.png

##   libfastcommon  c 
pkill -9 fdfs
pkill -9 nginx
rm -rf /usr/local/fast /usr/local/nginx* /usr/bin/fdfs* /etc/fdfs
mkdir -p /usr/local/fast
tar zxvf /usr/local/software/libfastcommon-1.0.38.tar.gz -C /usr/local/fast/
cd /usr/local/fast/libfastcommon-1.0.38/ && ./make.sh && ./make.sh install

##      
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so

## fastDFS     
tar zxvf /usr/local/software/fastdfs-5.11.tar.gz -C /usr/local/fast/
cd /usr/local/fast/fastdfs-5.11 && ./make.sh && ./make.sh install

##  tracker  
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
cat /etc/fdfs/tracker.conf | grep base_path
sed -i "s/base_path=\/home\/yuqing\/fastdfs/base_path=\/fastdfs\/tracker/g" /etc/fdfs/tracker.conf
mkdir -p /fastdfs/tracker
##      
## base_path=/fastdfs/tracker
#     ,  tracker     22122
firewall-cmd --list-ports
firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --reload
##  tracker
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
ps -ef | grep fdfs
##      
echo "/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf" >> /etc/rc.d/rc.local
cat /etc/rc.d/rc.local

##  fastdfs  
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
cat /etc/fdfs/storage.conf | grep base_path=
cat /etc/fdfs/storage.conf | grep store_path0=
cat /etc/fdfs/storage.conf | grep tracker_server=
cat /etc/fdfs/storage.conf | grep http.server_port=
sed -i "s/base_path=\/home\/yuqing\/fastdfs/base_path=\/fastdfs\/storage/g" /etc/fdfs/storage.conf
sed -i "s/store_path0=\/home\/yuqing\/fastdfs/store_path0=\/fastdfs\/storage/g" /etc/fdfs/storage.conf
sed -i "s/tracker_server=192.168.209.121:22122/tracker_server=192.168.0.130:22122/g" /etc/fdfs/storage.conf
sed -i "s/http.server_port=8888/http.server_port=8083/g" /etc/fdfs/storage.conf
mkdir -p /fastdfs/storage
##      
## base_path=/fastdfs/storage
## store_path0=/fastdfs/storage
## tracker_server=192.168.0.130:22122
## http.server_port=8083

#     ,      storage     23000
firewall-cmd --zone=public --add-port=23000/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports

##   storage
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
ps -ef | grep fdfs
##   storage     
echo "/usr/bin/fdfs_storaged /etc/fdfs/storage.conf" >> /etc/rc.d/rc.local
cat /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

##   client.conf  
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
cat /etc/fdfs/client.conf | grep base_path=
cat /etc/fdfs/client.conf | grep tracker_server=
cat /etc/fdfs/client.conf | grep http.tracker_server_port=
sed -i "s/base_path=\/home\/yuqing\/fastdfs/base_path=\/fastdfs\/tracker/g" /etc/fdfs/client.conf
sed -i "s/tracker_server=192.168.0.197:22122/tracker_server=192.168.0.130:22122/g" /etc/fdfs/client.conf
sed -i "s/http.tracker_server_port=80/http.tracker_server_port=8083/g" /etc/fdfs/client.conf
##      
## base_path=/fastdfs/tracker
## tracker_server=192.168.0.130:22122
## http.tracker_server_port=8083

##       (FastDFS       /usr/bin/fdfs_test    、     )
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /usr/local/software/1001.png


## FastDFS Nginx  
cd /usr/local/software/ && tar -zxvf fastdfs-nginx-module_v1.16.tar.gz -C /usr/local/fast/ 
##   conf    (           /usr/local/   /usr/,   )
cp /usr/local/fast/fastdfs-nginx-module/src/config /usr/local/fast/fastdfs-nginx-module/src/config.template
sed -i "s#CORE_INCS=\"\$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/\"#CORE_INCS=\"\$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/\"#g" /usr/local/fast/fastdfs-nginx-module/src/config
cat /usr/local/fast/fastdfs-nginx-module/src/config | grep CORE_INCS
##     
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

## Nginx    fastdfs  
tar zxvf /usr/local/software/nginx-1.6.2.tar.gz -C /usr/local/
cd /usr/local/nginx-1.6.2 && ./configure --add-module=/usr/local/fast/fastdfs-nginx-module/src/ && make && make install

##   fastdfs-nginx-module      , /etc/fdfs   
cp /usr/local/fast/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
cat /etc/fdfs/mod_fastdfs.conf | grep connect_timeout
cat /etc/fdfs/mod_fastdfs.conf | grep tracker_server
cat /etc/fdfs/mod_fastdfs.conf | grep url_have_group_name
cat /etc/fdfs/mod_fastdfs.conf | grep store_path0
sed -i "s#connect_timeout=2#connect_timeout=10#g" /etc/fdfs/mod_fastdfs.conf
sed -i "s#tracker_server=tracker:22122#tracker_server=192.168.0.130:22122#g" /etc/fdfs/mod_fastdfs.conf
sed -i "s#url_have_group_name = false#url_have_group_name = true#g" /etc/fdfs/mod_fastdfs.conf
sed -i "s#store_path0=/home/yuqing/fastdfs#store_path0=/fastdfs/storage#g" /etc/fdfs/mod_fastdfs.conf
##     
## connect_timeout=10
## tracker_server=192.168.0.130:22122
## url_have_group_name = true
## store_path0=/fastdfs/storage

##    FastDFS  2   , /etc/fdfs   
cd /usr/local/fast/fastdfs-5.11/conf/ && cp http.conf mime.types /etc/fdfs/
ln -s /fastdfs/storage/data/ /fastdfs/storage/data/M00

##   Nginx    
cat /usr/local/nginx/conf/nginx.conf | grep localhost
sed -i "s#80;#8083;#g" /usr/local/nginx/conf/nginx.conf
sed -i "s#localhost#192.168.0.130#g" /usr/local/nginx/conf/nginx.conf
sed -i "43,46c location ~/group([0-9])/M00 {
\t\tngx_fastdfs_module;
\t}
" /usr/local/nginx/conf/nginx.conf cat -n /usr/local/nginx/conf/nginx.conf | head -n 61 ## Nginx logs nginx.pid touch /usr/local/nginx/logs/nginx.pid echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local cat /etc/rc.d/rc.local ## firewall-cmd --add-port=8083/tcp --permanent firewall-cmd --reload firewall-cmd --list-ports ## , /usr/local/nginx/sbin/nginx /usr/bin/fdfs_test /etc/fdfs/client.conf upload /usr/local/software/1001.png

좋은 웹페이지 즐겨찾기