nginx.md 827 B

Nginx

安装

执行如焉命令安装Nginx源。

[root@localhost ~] rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

使用 yum 命令安装 Ngnix

[root@localhost ~] yum install nginx

配置开机启动与启动

[root@localhost ~] systemctl enable nginx
[root@localhost ~] systemctl start nginx

配置

常用 Nginx 命令

启动nginx

[root@localhost ~] nginx

测试 Nginx 配置是否正确

[root@localhost ~] nginx -t

重启 Nginx

[root@localhost ~] nginx -s reload

Nginx的默认路径

  • Nginx配置路径:/etc/nginx/
  • PID目录:/var/run/nginx.pid
  • 错误日志:/var/log/nginx/error.log
  • 访问日志:/var/log/nginx/access.log
  • 默认站点目录:/usr/share/nginx/html

Nginx 配置