qingkuangs 发表于 2018-11-14 06:21:38

搭建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
  cdnginx-1.13.4
  ./configure --prefix=/usr/local/nginx   安装模块参数这里不重要,安不安都无所谓
  make && make install
  创建vsftpd服务器的存放位置
  mkdir -p /home/xurui/www
  cd /home/xurui/www
  mkdir -p downloadsimagesmusicvideos
  配置nginx.conf文件,这是我粘贴出来自己的,可以直接用。
  # cat nginx.conf
  userroot;
  worker_processes1;
  events {
  worker_connections1024;
  }
  http {
  include       mime.types;
  default_typeapplication/octet-stream;
  sendfile      on;
  keepalive_timeout65;
  server {
  listen       80;
  server_namelocalhost;
  location / {
  root   html;
  indexindex.html index.htm;
  }
  location /images {
  root   /home/xurui/www/;
  autoindex on;
  }
  error_page404/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>  测试:
  在windows窗口“双击计算机” --> “点击上方输入栏-输入 ftp://你的ip地址进行登录”--> “之后右键点击空白处-登录按钮输入用户名和密码进行登录”
  端口是21
  用户名就是你设置的useradd那个
  密码就是设置的密码


  登录成功
  最后进行网页测试:
  输入ip地址即可
  http://192.168.200.203/images/ 回车即可。
  后期的代码可以进行单独存档。

  安装全部完成。
  END

页: [1]
查看完整版本: 搭建nginx+vsftpd详细