trhhrth 发表于 2014-9-23 08:56:10

nginx安装配置

nginx的编译安装方法
访问http://nginx.org/en/download.html 站点下载相应的软件版本,下载后解压文件。
编译安装前需要的开发环境
# yum -y install "Development tools"
# yum -y install "Server Platform Development"
# yum -y install pcre-devel
# yum -y installopenssl-devel
# ./configure 编译时可指定的参数
# ./configure \
--prefix=/usr/local/nginx \
--error-log-path=/data/applogs/nginx/error.log \
--http-log-path=/data/applogs/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \            指定nginx线程的用户身份
--group=nginx \
--with-http_ssl_module \      加载ssl模块
--with-http_flv_module \         支持flv模块
--with-http_stub_status_module \    支持从web网页查看nginx工作状态
--with-http_gzip_static_module \    支持gzip压缩模块
--http-client-body-temp-path=/usr/local/nginx/client/ \    客户端请求时需要暂时存储文件的位置,如上传文件等。
--http-proxy-temp-path=/usr/local/nginx/proxy/ \    作为反向代理服务器,后端服务器响应时产生的临时文件存放目录。
--http-fastcgi-temp-path=/usr/local/nginx/fcgi/ \    转发fcgi时的缓存目录
--http-uwsgi-temp-path=/usr/local/nginx/uwsgi \    反向代理python 的web服务器上使用的协议
--http-scgi-temp-path=/usr/local/nginx/scgi \    反向代理scgi时使用的缓存目录
--with-pcre      支持正则表达式
# make && make install

---------------------------------------------------------------------------
配置文件格式
--------------------------------------------------------------------------
nginx配置文件,所有#号开头的为注释,每句配置都要以分号结尾。
nginx基本配置的类别:
    用于调试、定位问题的配置项
    正常运行的必备配置项
    优化性能的配置项
    事件类的配置项,事件配置属于核心配置。
    main核心配置段,用来配置核心模块的工作特性。
    http {    http核心配置段用来配置http模块的工作特性
      参数名 值1 [值2];    定义参数
    }
    配置文件支支持全用变量,变量分为模块内置变量和用户自定义变量。
    set var_name value; 用户自定义变量设置方法。
----------------------------------------------------------------------

页: [1]
查看完整版本: nginx安装配置