文档详情

linux命令大全Nginx安装配置.docx

发布:2017-06-05约字共5页下载文档
文本预览下载声明
Nginx 安装配置系统平台:CentOS release 6.6 (Final) 64位。一、安装编译工具及库文件yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel二、首先要安装 PCREPCRE 作用是让 Ngnix 支持 Rewrite 功能。1、下载 PCRE 安装包,下载地址: /project/pcre/pcre/8.35/pcre-8.35.tar.gz[root@bogon src]# wget /project/pcre/pcre/8.35/pcre-8.35.tar.gz2、解压安装包:[root@bogon src]# tar zxvf pcre-8.35.tar.gz3、进入安装包目录[root@bogon src]# cd pcre-8.354、编译安装 [root@bogon pcre-8.35]# ./configure[root@bogon pcre-8.35]# make make install5、查看pcre版本[root@bogon pcre-8.35]# pcre-config --version安装 Nginx1、下载 Nginx,下载地址:/download/nginx-1.6.2.tar.gz[root@bogon src]# wget /download/nginx-1.6.2.tar.gz2、解压安装包[root@bogon src]# tar zxvf nginx-1.6.2.tar.gz3、进入安装包目录[root@bogon src]# cd nginx-1.6.24、编译安装[root@bogon nginx-1.6.2]# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35[root@bogon nginx-1.6.2]# make[root@bogon nginx-1.6.2]# make install5、查看nginx版本[root@bogon nginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -v到此,nginx安装完成。Nginx 配置创建 Nginx 运行使用的用户 www:[root@bogon conf]# /usr/sbin/groupadd www [root@bogon conf]# /usr/sbin/useradd -g www www配置nginx.conf ,将/usr/local/webserver/nginx/conf/nginx.conf替换为以下内容[root@bogon conf]# cat /usr/local/webserver/nginx/conf/nginx.confuser www www;worker_processes 2; #设置值和CPU核心数一致error_log /usr/local/webserver/nginx/logs/nginx_error.log crit; #日志位置和日志级别pid /usr/local/webserver/nginx/nginx.pid;#Specifies the value for maximum file descriptors that can be opened by this process.worker_rlimit_nofile 65535;events{ use epoll; worker_connections 65535;}http{ include mime.types; default_type application/octet-stream; log_format main $remote_addr - $remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for;#charset gb2312; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_
显示全部
相似文档