1. 程式人生 > >搭建nginx+vsftpd詳細

搭建nginx+vsftpd詳細

nginx vsftpd

一下為手敲可能會有錯誤的單詞或使用空格不當,自行處理


安裝vsftpd

yum -y install vsftpd

開機啟動

chkconfig vsftpd on

創建用戶

useradd xurui

設置密碼

echo "1qaz2wsx" |passwd xurui --stdin

啟動服務

/etc/init.d/vsftpd start

查看狀態

/etc/init.d/vsftpd status

重啟服務

/etc/init.d/vsftpd restart

停止服務

/etc/init.d/vsftpd stop

【至於配置文件/etc/vsftpd/vsftpd.conf內的參數開始問題,根據實際情況在另行配置】



安裝nginx

安裝依賴

yum -y install zlib* pcre*

tar zxvf nginx-1.13.4.tar.gz

cd nginx-1.13.4

./configure --prefix=/usr/local/nginx 安裝模塊參數這裏不重要,安不安都無所謂

make && make install


創建vsftpd服務器的存放位置

mkdir -p /home/xurui/www

cd /home/xurui/www

mkdir -p downloads images music videos


配置nginx.conf文件,這是我粘貼出來自己的,可以直接用。

[root@amunlinux conf]# cat nginx.conf

user root;

worker_processes 1;


events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;



sendfile on;

keepalive_timeout 65;



server {

listen 80;

server_name localhost;



location / {

root html;

index index.html index.htm;

}

location /images {

root /home/xurui/www/;

autoindex on;

}

error_page 404 /404.html;

error_page 500 502 503 504 /50x.html;

error_log /var/log/nginx/debug.log debug;

location = /50x.html {

root html;

}

location ^~ /packages {

root /home/xurui/www/downloads;

autoindex on;

autoindex_exact_size on;

autoindex_localtime on;

allow all;

}

location ^~ /music {

root /home/xurui/www/;

autoindex on;

autoindex_exact_size on;

autoindex_localtime on;

allow all;

}

location ^~ /videos {

root /home/xurui/www/;

autoindex on;

autoindex_exact_size on;

autoindex_localtime on;

allow all;

}

location ^~ /html5 {

root /home/xurui/www/;

autoindex on;

autoindex_exact_size on;

autoindex_localtime on;

allow all;

}

location = /404.html {

root /usr/share/nginx/html;

}

}

}


按照我的配置重啟nginx

nginx -s reload


測試:

在windows窗口“雙擊計算機” --> “點擊上方輸入欄-輸入 ftp://你的ip地址進行登錄”--> “之後右鍵點擊空白處-登錄按鈕輸入用戶名和密碼進行登錄”

端口是21

用戶名就是你設置的useradd那個

密碼就是設置的密碼

技術分享

技術分享


登錄成功


最後進行網頁測試:

輸入ip地址即可

http://192.168.200.203/images/ 回車即可。

後期的代碼可以進行單獨存檔。

技術分享




安裝全部完成。


END

本文出自 “微清涼風的博客” 博客,請務必保留此出處http://amunlinux.blog.51cto.com/13112118/1981777

搭建nginx+vsftpd詳細