服务器配置

本文详细介绍如何在Linux环境下进行网络配置,包括网卡的开关操作、自动获取IP地址的方法、防火墙的开启与关闭步骤;此外还讲解了Apache服务器的配置过程,涉及默认主页设置、个人主页配置及访问权限控制等;最后介绍了NFS、FTP服务的配置方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

网卡开闭 ifconfig eth0 down ifconfig eth0 up

自动获取IP dhclient eth0

打开关闭防火墙 chkconfig iptables on/off


1.etc/httpd/httpd.conf 配置文件

2.配置默认主页

/var/www/html

Vim index.html

3.配置个人主页

#UserDir disable

UserDir public_html 去掉注释

去掉以下注释

370<Directory /home/*/public_html>

371 AllowOverride FileInfo AuthConfig Limit

372 Options MultiViews IndexesSymLinksIfOwnerMatch IncludesNoExec

373 <Limit GET POST OPTIONS>

374 Order allow,deny

375 Allow from all

376 </Limit>

377 <LimitExcept GET POST OPTIONS>

378 Order deny,allow

379 Deny from all

380 </LimitExcept>

381 </Directory>

添加用户user1 useradd user1

密码 passwd 123456

在user1 中mkdir public_html

更改权限 chmod 711 user1

在public_html中建立index.html文件

4.配置访问权限

建立/var/www/html/testDir目录

在testDir中建立文件 a.txt b.txt c.txt

编辑配置文件

cd /etc/httpd/conf.d

vim aaa.conf (结尾一定是.conf)

除了192.168.0.100之外其他都能访问

<Directory/var/www/html/testDir>

Order allow,deny

Allow from all

Deny from 192.168.0.100

</Directory>

192.168.0.100/testDir 不能访问

cd /etc/httpd/conf.d

vim bbb.conf (结尾一定是.conf)

只有192.168.0.100 其他都不能访问

<Directory/var/www/html/testDir>

Order deny,allow

Deny from all

Allow from 192.168.0.100

</Directory>

192.168.0.100/testDir 不能访问

5.NFs

Vim /etc/exports

/home/zbq 192.168.0.1 ro

Service portmap start

Service nfs start

6.FTP

进入配置文件 cd /etc/vsftpd/vsftpd.conf

31 anon_mkdir_write_enable=YES

32 #

33 # Activate directory messages - messagesgiven to remote users when they

34 # go into a certain directory.

35 dirmessage_enable=YES

36 #

限制本地用户登录FTP时改变目录

94 chroot_list_enable=YES

95 # (default follows)

96chroot_list_file=/etc/vsftpd/chroot_list

登录FTP服务器的欢迎消息

82 # You may fully customise the login banner string:

83 ftpd_banner=Welcometo blah FTP service.

84 #

配置登录FTP服务器目录的欢迎消息(匿名用户为例)

1. 在目录中建立欢迎消息文件

cd /var/ftp/pub

Vi .message


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值