首页 > 代码库 > Nginx入门
Nginx入门
Nginx、一款开源的高并发、均衡负载、占用内存小
实测平台:RHEL7
官网:http://nginx.org/
01:已经编译好的平台包: http://nginx.org/packages/
02:wget http://nginx.org/packages/rhel/7/noarch/RPMS/nginx-release-rhel-7-0.el7.ngx.noarch.rpm
安装nginx: rpm -ivh nginx-release-rhel-7-0.el7.ngx.noarch.rpm
03:yum安装nginx
yum install -y nginx
04:nginx的几个默认目录
输入命令: whereis nginx
nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx
1) 配置所在目录:/etc/nginx/
2) PID目录:/var/run/nginx.pid
3) 错误日志:/var/log/nginx/error.log
4) 访问日志:/var/log/nginx/access.log
5) 默认站点目录:/usr/share/nginx/html
05:启动nginx
systemctl enable nginx;systemctl start nginx
06:添加防火墙通行
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
测试nginx配置: nginx -t curl http://127.0.0.1
查看nginx配置信息:nginx -V
Nginx入门