{{ v.name }}
{{ v.cls }}类
{{ v.price }} ¥{{ v.price }}
系统平台:centosrelease6.6(final)64位。
yum-yinstallmakezlibzlib-develgcc-c++libtoolopensslopenssl-devel二、首先要安装pcre
pcre作用是让nginx支持rewrite功能。
1、下载pcre安装包,下载地址:http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@bogonsrc]#wgethttp://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
2、解压安装包:
[root@bogonsrc]#tarzxvfpcre-8.35.tar.gz
3、进入安装包目录
[root@bogonsrc]#cdpcre-8.35
4、编译安装
[root@bogonpcre-8.35]#./configure[root@bogonpcre-8.35]#make&&makeinstall
5、查看pcre版本
[root@bogonpcre-8.35]#pcre-config--version
1、下载nginx,下载地址:http://nginx.org/download/nginx-1.6.2.tar.gz
[root@bogonsrc]#wgethttp://nginx.org/download/nginx-1.6.2.tar.gz
2、解压安装包
[root@bogonsrc]#tarzxvfnginx-1.6.2.tar.gz
3、进入安装包目录
[root@bogonsrc]#cdnginx-1.6.2
4、编译安装
[root@bogonnginx-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@bogonnginx-1.6.2]#make[root@bogonnginx-1.6.2]#makeinstall
5、查看nginx版本
[root@bogonnginx-1.6.2]#/usr/local/webserver/nginx/sbin/nginx-v
到此,nginx安装完成。
创建nginx运行使用的用户www:
[root@bogonconf]#/usr/sbin/groupaddwww[root@bogonconf]#/usr/sbin/useradd-gwwwwww
配置nginx.conf,将/usr/local/webserver/nginx/conf/nginx.conf替换为以下内容
[root@bogonconf]#cat/usr/local/webserver/nginx/conf/nginx.confuserwwwwww;worker_processes2;#设置值和cpu核心数一致error_log/usr/local/webserver/nginx/logs/nginx_error.logcrit;#日志位置和日志级别pid/usr/local/webserver/nginx/nginx.pid;#specifiesthevalueformaximumfiledescriptorsthatcanbeopenedbythisprocess.worker_rlimit_nofile65535;events{useepoll;worker_connections65535;}http{includemime.types;default_typeapplication/octet-stream;log_formatmain'$remote_addr-$remote_user[$time_local]"$request"''$status$body_bytes_sent"$http_referer"''"$http_user_agent"$http_x_forwarded_for';#charsetgb2312;server_names_hash_bucket_size128;client_header_buffer_size32k;large_client_header_buffers432k;client_max_body_size8m;sendfileon;tcp_nopushon;keepalive_timeout60;tcp_nodelayon;fastcgi_connect_timeout300;fastcgi_send_timeout300;fastcgi_read_timeout300;fastcgi_buffer_size64k;fastcgi_buffers464k;fastcgi_busy_buffers_size128k;fastcgi_temp_file_write_size128k;gzipon;gzip_min_length1k;gzip_buffers416k;gzip_http_version1.0;gzip_comp_level2;gzip_typestext/plainapplication/x-javascripttext/cssapplication/xml;gzip_varyon;#limit_zonecrawler$binary_remote_addr10m;#下面是server虚拟主机的配置server{listen80;#监听端口server_namelocalhost;#域名indexindex.htmlindex.htmindex.php;root/usr/local/webserver/nginx/html;#站点目录location~.*.(php|php5)?${#fastcgi_passunix:/tmp/php-cgi.sock;fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;includefastcgi.conf;}location~.*.(gif|jpg|jpeg|png|bmp|swf|ico)${expires30d;#access_logoff;}location~.*.(js|css)?${expires15d;#access_logoff;}access_logoff;}}
检查配置文件ngnix.conf的正确性命令:
[root@bogonconf]#/usr/local/webserver/nginx/sbin/nginx-t