目录
1.是什么?
2.httpd和nginx的区别
3.安装
4.修改配置文件
5.启动httpd服务
6.设置开机启动
1.是什么?
Apache HTTPD又可以简称为httpd或者Apache,它是Internet使用最广泛的web服务器之一。
2.httpd和nginx的区别
nginx是俄罗斯人编写的十分轻量级的HTTP服务器,是一个高性能的HTTP和反向代理服务器。
Nginx相对于Apache:
1、高并发响应性能非常好。(单台万级并发连接30000-50000/s(简单静态页))
2、反向代理性能非常好。(可用于负载均衡)
3、内存和cpu占用率低。(为Apache的1/5-1/10)
4、功能较Apache少(常用功能均有)
3.安装
yum -y install httpd
4.修改配置文件
vim /etc/httpd/conf/httpd.conf
vim /etc/httpd/conf/httpd.conf
没有想改动的可以使用默认
Listen 80
#默认80端口,可修改为其他端口
User ftpadmin #修改为对应的ftp访问用户
Group ftpadmin #修改为对应的ftp访问用户组
DocumentRoot "/home/ftp" #修改为ftp用户实际的访问目录
##修改为ftp用户实际的访问目录 AllowOverride None
# Allow open access:
Require all granted
Allow from all ##添加
5.启动httpd服务
service httpd start #启动httpd
service httpd restart #重启httpd
6.设置开机启动
chkconfig httpd on
7.测试
chkconfig httpd on7.测试
在访问目录,默认/var/www/html下新建hello.html
内容如下
hello
访问http://ip:port/hello.html,返回结果"hello" 说明没问题



