linux nfs nignx ftp搭建

1.nfs搭建

nfs:网络文件系统搭建nfs至少需要两台linux,linux1作为nfs客户端,linux2作为nfs服务器主机1(10.0.142.34,nfs服务器) 主机2(10.0.142.23 nfs客户端)
nfs服务器
1、yum install -y nfs-utils
2、编辑配置文件
vi /etc/exports
/test    10.0.142.0/24(rw,sync)
要共享的目录        网段
3、启动服务
nfs服务是基于rpc协议的
service rpcbind start
service nfs start
nfs客户端
1、yum install -y nfs-utils
2、查看对应的ip地址上面共享的目录
showmount -e 10.36.131.133(nfs服务器ip地址)
3、将共享的目录挂载到本地
mount -t nfs 10.0.142.34:/test/ /root/bajie
4、设置开机挂载
vi /etc/fstab
10.0.142.34:/test/   /root/nfs   nfs   defaults  0   0

设备                 挂载点      格式   默认

2.nginx服务搭建

安装nginx1、关闭防火墙和selinux2、安装一些依赖的软件yum install -y gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel

3、创建www用户,但是不允许www用户登录系统

useradd www -s /sbin/nologin

4、安装

tar -zxvf nginx-1.11.5.tar.gz
cd nginx-1.11.5
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www   --with-http_stub_status_module --with-http_ssl_module

make && make install

5、设置nginx开机启动

cp nginx /etc/init.d
chmod 755 /etc/init.d/nginx
chkconfig nginx on
chkconfig --list    查看是否开机启动

service nginx start | stop | restart

6、配置虚拟主机

ip地址找到服务器的
域名====》ip对应着呢
www.baidu.com====>DNS====>得到真实的ip地址
然后再根据ip地址再来访问服务器


解决多个网站同时放到同一台服务器上
www.hehe.com===>10.0.142.34
www.lala.com===>10.0.142.34
www.haha.com===>10.0.142.34


vi /usr/local/nginx/conf/nginx.conf
37gg   给一个server_name
service nginx restart


windows下面hosts文件
C:\Windows\System32\drivers\etc\hosts
10.0.142.34  www.lala.com


配置虚拟主机步骤
1、vi /usr/local/nginx/conf/nginx.conf
2、最后一个大括号的上面
include vhost/*.conf;
3、mkdir /usr/local/nginx/conf/vhost
4、vi /usr/local/nginx/conf/vhost/www.hehe.com.conf
server
{
server_name www.hehe.com;    
root html/hehe;
index index.html;
}

server_name   域名
root          站点目录,网站的目录
index         网站默认的首页
5、mkdir /usr/local/nginx/html/hehe
6、vi /usr/local/nginx/html/hehe/index.html
这是我的hehe网站

7、service nginx restart

3.ftp搭建

【注】关闭防火墙和selinux
【注】依赖  gcc和openssl-devel和perl
0、yum install -y gcc openssl-devel perl
1、去pureftp官网
download==》releases==》pure-ftpd-1.0.41.tar.gz
2、下载
wget https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.46.tar.gz
3、解压
tar -zxvf 文件名
4、配置
./configure                    #进行配置  -h 查看配置参数
--prefix=/usr/local/pureftpd   #安装目录
--without-inetd                #不使用ineted 超级服务器管理
--with-altlog                  #采用alt日志
--with-puredb                #采用puredb来存储ftp虚拟用户信息
--with-throttling              #开启带宽控制
--with-tls                    #开启ftps支持
 
./configure --prefix=/usr/local/pureftpd --without-inetd --with-altlog --with-puredb --with-throttling --with-tls
 
make && make install
5、修改配置文件
cd configuration-file/
mkdir /usr/local/pureftpd/etc/   创建目录
cp pure-ftpd.conf  /usr/local/pureftpd/etc/
修改:vi /usr/local/pureftpd/etc/pure-ftpd.conf 如下
PureDB /usr/local/pureftpd/etc/pureftpd.pdb
PIDFile /var/run/pure-ftpd.pid
6、拷贝控制文件
cp pure-config.pl /usr/local/pureftpd/sbin/
chmod 755 /usr/local/pureftpd/sbin/pure-config.pl
7、启动服务
cd /usr/local/pureftpd
./sbin/pure-config.pl  ./etc/pure-ftpd.conf
检查:ps -ef | grep ftp
8、添加管理用户
useradd  test
mkdir -p /var/www/html/
chown -R test:test /var/www/html/
./bin/pure-pw useradd ftp_user1 -u test -d /var/www/html
ftp_user1:ftp登录用户名
-u:指定系统中存在的用户
-d:指定访问的目录
9、创建虚拟的用户数据库
./bin/pure-pw mkdb
/usr/local/pureftpd/bin/pure-pw list         #查看用户列表
/usr/local/pureftpd/bin/pure-pw userdel  用户名 #删除用户
10、通过ftp链接工具(FileZilla)测试


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值