下载
wget http://nginx.org/download/nginx-1.14.0.tar.gz
解压
tar -zxvf nginx-1.14.0.tar.gz cd nginx-1.14.0/
configure
./configure
可能出现的错误
./configure: error: C compiler cc is not found 执行 yum -y install gcc gcc-c++ autoconf automake make /configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option. 缺少pcre,zlib依赖 前者为了重写rewrite,后者为了gzip压缩 执行 yum -y install pcre-devel yum -y install zlib-devel ./configure: error: the HTTP cache module requires md5 functions from OpenSSL library... 缺少openssl依赖 执行 yum -y install openssl openssl-devel
configure成功
nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
编译
make
安装
make install
相关命令
启动 /usr/local/nginx/sbin/nginx 停止/重新加载 /usr/local/nginx/sbin/nginx -s stop(reload) 验证配置文件是否合法 /usr/local/nginx/sbin/nginx -t
浏览器访问 http://ip
注意防火墙
停止:
systemctl stop firewalld.service