001.Nginx安装

2020-03-25 17:51:11 浏览数 (1)

  • nginx下载地址:http://nginx.org/en/download.html
  • 本文使用:nginx-1.16.1
  1. 安装依赖软件 yum -y install gcc gcc-c pcre pcre-devel openssl openssl-devel zlib zlib-devel
  2. 安装nginx
  • 解压进入nginx目录 tar -zxvf nginx-1.16.1.tar.gz
  • 安装nginx [root@magic nginx-1.16.1]# ./configure [root@magic nginx-1.16.1]# make && make install
  • nginx安装到了/usr/local/nginx目录下
  1. 启动nginx [root@magic ~]# /usr/local/nginx/sbin/nginx # 查看启动进程 [root@magic ~]# ps -ef | grep nginx root 7950 1 0 16:11 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx nobody 7951 7950 0 16:11 ? 00:00:00 nginx: worker process
  2. 访问页面 http://hostname:80/
  1. nginx启停命令 # 启动 /usr/local/nginx/sbin/nginx # 停止 /usr/local/nginx/sbin/nginx -s stop # 重新加载配置(热加载),并非重启服务 /usr/local/nginx/sbin/nginx -s reload

0 人点赞