nginx1.14.1安装与配置
- 1.下载
下载地址:http://nginx.org/en/download.html
- 2.环境准备
GCC:编译开发环境。
PCRE:nginx的HTTP模块要用它来解析正则表达式。
ZLIB:gzip格式的压缩会用到它。
OpenSSL:主要用于https加密。
1 #本文主要是安装nginx,准备环境以yum在线方式安装 2 sudo yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre pcre-devel
- 3.安装nginx
1 ]# tar -zxvf nginx-1.14.0.tar.gz #解压 2 ]# cd nginx-1.14.0/ #切换到nginx目录 3 ]# ./configure --prefix=/usr/local/nginx --pid-path=/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre #生成 Makefile,为下一步的编译做准备 4 ##注意:自定义配置容易出现异常,建议使用默认配置即可:./configure 5 ]# make #编译 6 ]# make install #安装
附:
1 Configuration summary 2 + using system PCRE library 3 + OpenSSL library is not used 4 + using system zlib library 5 6 nginx path prefix: "/usr/local/nginx" 7 nginx binary file: "/usr/local/nginx/sbin/nginx" 8 nginx modules path: "/usr/local/nginx/modules" 9 nginx configuration prefix: "/usr/local/nginx/conf" 10 nginx configuration file: "/usr/local/nginx/conf/nginx.conf" 11 nginx pid file: "/usr/local/nginx/logs/nginx.pid" 12 nginx error log file: "/usr/local/nginx/logs/error.log" 13 nginx http access log file: "/usr/local/nginx/logs/access.log" 14 nginx http client request body temporary files: "client_body_temp" 15 nginx http proxy temporary files: "proxy_temp" 16 nginx http fastcgi temporary files: "fastcgi_temp" 17 nginx http uwsgi temporary files: "uwsgi_temp" 18 nginx http scgi temporary files: "scgi_temp"
1 ./configure 参数说明: 2 –prefix #nginx安装目录,默认在/usr/local/nginx 3 –pid-path #pid问件位置,默认在logs目录 4 –lock-path #lock问件位置,默认在logs目录 5 –with-http_ssl_module #开启HTTP SSL模块,以支持HTTPS请求。 6 –with-http_dav_module #开启WebDAV扩展动作模块,可为文件和目录指定权限 7 –with-http_flv_module #支持对FLV文件的拖动播放 8 –with-http_realip_module #支持显示真实来源IP地址 9 –with-http_gzip_static_module #预压缩文件传前检查,防止文件被重复压缩 10 –with-http_stub_status_module #取得一些nginx的运行状态 11 –with-mail #允许POP3/IMAP4/SMTP代理模块 12 –with-mail_ssl_module #允许POP3/IMAP/SMTP可以使用SSL/TLS 13 –with-pcre=../pcre-8.11 #注意是未安装的pcre路径 14 –with-zlib=../zlib-1.2.5 #注意是未安装的zlib路径 15 –with-debug #允许调试日志 16 –http-client-body-temp-path #客户端请求临时文件路径 17 –http-proxy-temp-path #设置http proxy临时文件路径 18 –http-fastcgi-temp-path #设置http fastcgi临时文件路径 19 –http-uwsgi-temp-path=/var/tmp/nginx/uwsgi #设置uwsgi 临时文件路径 20 –http-scgi-temp-path=/var/tmp/nginx/scgi #设置scgi 临时文件路径
- 4.启动nginx
1 ]# cd /usr/local/nginx 2 ]# ./nginx
posted on 2020-10-15 17:50 Cooper_73 阅读(2184) 评论(0) 编辑 收藏 举报