nginx版本选择
http://nginx.org/en/download.html
选择稳定版本

Nginx的版本有:
- Mainline version:Mainline 是 Nginx 目前主力在做的版本,可以说是开发版。
- Stable version:最新稳定版,生产环境上建议使用的版本。
- Legacy versions:遗留的老版本的稳定版。
一般就选最新版本,Stable version:最新稳定版。
http://nginx.org/en/linux_packages.html#RHEL-CentOS
Installation instructions
Before you install nginx for the first time on a new machine, you need to set up the nginx packages repository. Afterward, you can install and update nginx from the repository.
RHEL/CentOS
Install the prerequisites:
sudo yum install yum-utils
To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key
By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:
sudo yum-config-manager --enable nginx-mainline
To install nginx, run the following command:
sudo yum install nginx
When prompted to accept the GPG key, verify that the fingerprint matches 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62, and if so, accept it.
源码编译版
./configure --user=nobody --group=nobody --prefix=/usr/local/sbin/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2019/08/15 11:43:49 [warn] 26143#26143: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2
2019/08/15 11:43:49 [emerg] 26143#26143: mkdir() "/var/cache/nginx/client_temp" failed (13: Permission denied)
nginx https
172.21.203.14 - - [15/Aug/2019:13:45:05 +0800] "\x16\x03\x01\x017\x01\x00\x013\x03\x03:\xF6\xAD\xE5`1\xE3\xF9\xFF\xE7\xE3\xE9\xEC\xC4\xBA\x90\xE1\xEE\x11\xD2\x1E\xB8]\xA4\x8Fo.\x85+\xFD$\xC5\x00\x00\xAC\xC00\xC0,\xC0(\xC0$\xC0\x14\xC0" 400 157 "-" "-" "-"









