Nginx源码编译安装 下载Nginx Nginx1.10.0.tar.gz wget http://nginx.org/download/nginx-1.10.0.tar.gz Nginx-1.12.1.tar.gz wget https://nginx.org/download/nginx-1.12.1.tar.gz Nginx-1.13.5.tar.gz wget https://nginx.org/download/nginx-1.13.5.tar.gz 官网获取最新版本 http://nginx.org/en/download.html 安装Nginx相关依赖包 yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel 解包配置 tar -zxf nginx-1.10.0.tar.gz cd nginx-1.10.0 ./configure \ --prefix=/usr/local/nginx \ --sbin-path=/usr/local/nginx/sbin/ \ --conf-path=/usr/local/nginx/conf/nginx.conf \ --with-http_ssl_module --user=www --group=www \ --with-http_gzip_static_module --with-http_stub_status_module \ --with-http_realip_module
编译安装
make && make install 查看版本 /usr/local/nginx/sbin/nginx -V 启动Nginx服务 /usr/local/nginx/sbin/nginx如果在make install 是报以下错误
创建/usr/local/nginx/sbin即可
mkdir /usr/local/nginx/sbin
启动时如果报以下错误
nginx: [emerg] getpwnam(“www”) failed
创建www用户即可
useradd -s /sbin/nologin www