linux服务器搭建(http)
搭建web服务器
1、查看是否有HTTP服务
rpm –qa|grep httpd
2、挂载
mkdir /mnt/cdrom
mount –t iso9660 /dev/cdrom /mnt/cdrom
3、找到server文件夹
cd /mnt/cdrom/Server
4、安装httpd服务
ls httpd*
rpm –ivh apr-1.2.7-11.el5.i386.rpm
rpm –ivh postgresql-libs-8.1.11-1.el5_1.1.i386.rpm
rpm –ivh apr-util-1.2.7-7.el5.i386.rpm
rpm –ivh httpd-2.2.3-22.el5.i386.rpm
5、检查安装
rpm -qa|grep httpd
6、配置文件
vi /etc/httpd/conf/httpd.conf
①57行:ServerRoot http运行目录
②68行:TimeOut 超时
③134行:Listen 监听端口(80)
④251行:ServerAdmin 邮箱地址
⑤265行:ServerName 写域名或IP地址
⑥281行:DocumentRoot 访问网页目录
⑦391行:DirectoryIndex 默认访问的页面(首页)
⑧747行:AddDefaultCharset 默认字体编码
⑨目录设置:
<Directoryf>
Order allow.deny
Allow from 192.168.1.0/24
Deny from 192.168.1.200
</Directory>
⑩虚拟目录:958行
<VirturalHost*: 80> 注释:*指当前本地ip地址(可不写)
ServerName www.fendoujiaoyu.com
DocumentRoot /var/www/html
</VirturalHost>
<VirturalHost*: 80>
ServerName bbs.fendoujiaoyu.com
DocumentRoot /var/www/html/pbbs
</VirturalHost>
7、开启服务
chkconfig httpd on 或 service httpd start
参考:https://blog.csdn.net/wh_forever/article/details/51750606