signed

QiShunwang

“诚信为本、客户至上”

Linux只需9行命令安装Nginx

2021/4/26 15:18:50   来源:
  1. yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel #下载依赖
  2. cd /usr/local #进入用户目录
  3. mkdir nginx #创建nginx文件夹
  4. wget http://nginx.org/download/nginx-1.13.7.tar.gz # 下载nginx tar包
  5. tar -xvf nginx-1.13.7.tar.gz # 解压nginx tar包
  6. cd nginx-1.13.7 进入解压后的nginx1.13.7
  7. ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module # 配置SSL模块
  8. make 是一个命令工具,编译的意思 ./comfigure后跟着make
  9. make install 依赖安装

运行nginx

  • /usr/local/nginx/sbin/nginx -s reload
  • 出现错误:nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
  • 运行下面的命令
  • /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  • 成功就可以访问自己的域名http://www.fatesgo.com