web服务器的基本用法(nginx、httpd(apache))
目录
Nginx是一款轻量级HTTP服务器,也是一款邮箱代理服务器,同时具备反向代理、通用TCP/UDP代理的功能
Apache 是一个模块化的服务器,可以运行在几乎所有广泛使用的计算机平台上,属于应用服务器,本身是静态解析,适合静态 HTML、图片等。
Apache 和 NGINX 的主要区别在于其设计架构。Apache 使用进程驱动的方法,并为每个请求创建一个新线程。NGINX 使用事件驱动的体系结构来处理一个线程中的多个请求。
1、安装
yum install nginx -y # nginx安装
yum install httpd -y # apache安装
2、启动
systemctl enable --now httpd
systemctl enable --now nginx
3、默认发布目录
/usr/www/html/ # apache默认发布目录
/usr/share/nginx/html # nginx默认发布目录
可修改配置文件更改默认发布目录
/etc/httpd/conf/httpd.conf
/etc/nginx/nginx.conf
统一两者的发布目录 /web/html
echo /web/html page > /web/html/index.html