nginx.md 777 B

安装Nginx

安装Nginx源

执行如焉命令安装Nginx源

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

安装Nginx

[root@localhost ~] yum install nginx

配置开机启动与启动

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

常用命令

启动nginx

[root@localhost ~] nginx

测试Nginx配置是否正确

[root@localhost ~] nginx -t

优雅重启

[root@localhost ~] nginx reload

Nginx的默认路径

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