centos7安装nginx1.12.2步骤指南

安装nginx

下载

从公司机器下载nginx-1.12.2-1.el7_4.ngx.x86_64.rpmhtml

或者:http://nginx.org/download/ nginx安装包下载地址。nginx

安装

[nginx[@test2](https://my.oschina.net/u/1253032) ~]$ rpm -ivh nginx-1.12.2-1.el7_4.ngx.x86_64.rpm
warning: nginx-1.12.2-1.el7_4.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

解决:用root用户。测试

用root安装

[root[@test2](https://my.oschina.net/u/1253032) nginx]# rpm -ivh nginx-1.12.2-1.el7_4.ngx.x86_64.rpm
warning: nginx-1.12.2-1.el7_4.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:nginx-1:1.12.2-1.el7_4.ngx       ################################# [100%]
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* http://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------

访问nginx主页

http://10.13.22.19:80.net

目录

  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

经常使用命令

  1. 启动nginx:nginx
  2. 重启nginx(不杀进程,从新加载nginx.conf):killall -HUP nginx
  3. 中止nginx:nginx -s stop
  4. 测试nginx配置:nginx -t
相关文章
相关标签/搜索