1.安装vsftpd
- yum install vsftpd
- useradd ftpuser 添加ftp服务器用户
- passwd ftpuser 设置ftp文件服务器密码
- vim /etc/sysconfig/iptables 允许通过防火墙
在行上面有22 -j ACCEPT 把22换成21,然后:wq保存。
- service iptables restart 重启防火墙
- getsebool -a | grep ftp 修改selinux
[root@bogon ~]# setsebool -P allow_ftpd_full_access on
[root@bogon ~]# setsebool -P ftp_home_dir on
- 关闭匿名访问 vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
pasv_min_port=30000
pasv_max_port=30999
- 重启ftp服务 service vsftpd restart
- 设置开机启动vsftpd ftp服务chkconfig vsftpd on
2.安装nginx并配置服务
- yum install nginx
- mkdir /usr/share/nginx/html/images 需要在nginx/html下创建一个images文件夹
- vim /etc/nginx/nginx.conf 在默认的server里再添加一个location并指定实际路径:
location /images/ {
root /home/ftpuser/www/;
autoindex on;
}
//1) root则是将images映射到/home/ftpuser/www/images/
//2) autoindex on便是打开浏览功能。
- service nginx restart 完成重启服务
- 修改用户访问权限
chown ftpuser /home/ftpuser
chmod 777 -R /home/ftpuser
常用的一些Liunx服务命令
cd .. 查看上一级目录
cd xx 进入下一级目录
systemctl start xxx 启动某个服务
systemctl stop xxx 停止某个服务
systemctl restart xxx 重启某个服务
service xxx reload 重启某个文件配置后的服务
netstat -ntlp 查看当前所有tcp端口
lsof -i查看端口占用情况
netstat -ntlp|grep 3306 具体查看某个端口
1:查看防火状态
systemctl status firewalld
service iptables status
2:暂时关闭防火墙
systemctl stop firewalld
service iptables stop
3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
4:重启防火墙
systemctl enable firewalld
service iptables restart
5:永久关闭后重启
chkconfig iptables on
压缩:tar -jcv -f filename.tar.bz2 要被处理的文件或目录名称
查询:tar -jtv -f filename.tar.bz2
解压:tar -jxv -f filename.tar.bz2 -C 欲解压缩的目录
6:查看日志
cat filename 查看日志,会打开整个文件,直接跑到最后面
tac filename 查看日志,会打开整个文件,倒序显示,不常用
more filename 查看日志,可以上下翻页,上下行移动显示
less filename 查看日志,和more命令类似,但不能往回翻页
ail -f filename 查看文件,实时显示最后一页
vi filename 查看或编辑文件