所需软件名称及版本:pcre-8.02.tar.gznginx-0.7.58.tar.gzNginx_upstream_hash-0.3.1.tar.gz
序列号 | CPU | RAM | HDD | 带宽 | 售价(美元) | 免费试用 |
---|---|---|---|---|---|---|
香港服务器1 | E5-2620 | 32G | 1T HDD | 50M/无限流量 | $196.00 | 立即申请 |
香港服务器2 | E5-2650 | 32G | 1T HDD | 50M/无限流量 | $256.00 | 立即申请 |
香港服务器3 | E5-2680 | 32G | 1T HDD | 50M/无限流量 | $316.00 | 立即申请 |
香港服务器4 | E5-2690 | 32G | 1T HDD | 50M/无限流量 | $336.00 | 立即申请 |
香港服务器5 | E5-2697 | 32G | 1T HDD | 50M/无限流量 | $376.00 | 立即申请 |
香港服务器6 | E5-2620*2 | 32G | 1T HDD | 50M/无限流量 | $376.00 | 立即申请 |
香港服务器7 | E5-2650*2 | 32G | 1T HDD | 50M/无限流量 | $436.00 | 立即申请 |
香港服务器8 | E5-2680*2 | 32G | 1T HDD | 50M/无限流量 | $476.00 | 立即申请 |
香港服务器9 | E5-2690*2 | 32G | 1T HDD | 50M/无限流量 | $556.00 | 立即申请 |
香港服务器10 | E5-2697*2 | 32G | 1T HDD | 50M/无限流量 | $596.00 | 立即申请 |
香港服务器11 | E5-2680v4*2 | 32G | 1T HDD | 50M/无限流量 | $696.00 | 立即申请 |
香港服务器12 | E5-2698v4*2 | 32G | 1T HDD | 50M/无限流量 | $796.00 | 立即申请 |
1、安装pcretar-zxvfpcre-8.02.tar.gz cdpcre-8.02/ ./configure make&&makeinstall
2、给nginx安装url_hash补丁tar-zxvfnginx-0.7.58.tar.gz tar-zxvfNginx_upstream_hash-0.3.1.tar.gzcdnginx-0.7.58/ patch-p0
3、安装nginxgroupaddwww useraddwww-gwww ./configure--prefix=/usr/local/webserver/nginx--user=www --group=www --add-module=/var/tmp/loojoy/nginx_upstream_hash-0.3.1--with-http_ssl_module --with-http_stub_status_module
4、检查nginx生成的配置文件是否正确/usr/local/webserver/nginx/sbin/nginx-t
5、启动nginx若nginx.conf检查通过,则启动nginx。/usr/local/webserver/nginx/sbin/nginx6、查看端口80netstat -ant
7、通过浏览器访问:http://your_nginx_server_ip/若可以正常访问,则nginx安装成功。
8、修改nginx的配置文件如下:
-------------------url_hash转发方式nginx.conf--------------------userwwwwww; worker_processes10; error_loglogs/error.log; #error_loglogs/error.lognotice; #error_loglogs/error.loginfo; #pidlogs/nginx.pid;worker_rlimit_nofile51200;events { useepoll;worker_connections51200;} http { includemime.types;default_typeapplication/octet-stream;keepalive_timeout120;tcp_nodelayon;upstreamyour.website.name{serveryour.tomcat.server.ip1:8080;serveryour.tomcat.server.ip1:8080;hash$request_uri;} server { listen80;server_nameyour.website.name;location/{proxy_passhttp://your.website.name;proxy_set_headerHost$host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;}log_formatwww_gjw_com'$remote_addr-$remote_user[$time_local]$request''"$status"$body_bytes_sent"$http_referer"''"$http_user_agent""$http_x_forwarded_for"';#access_log/data1/logs/www.logwww_gjw_com;location/nginx_status{stub_statuson;access_logoff;}} } -------------------[E]url_hash转发方式nginx.conf[E]--------------------
9、添加nginx启动、关闭、重启脚本-------------------[S]url_hash转发方式nginx启动、关闭脚本[S]--------------------#!/bin/sh CWD=`pwd` case$1in start)/usr/local/webserver/nginx/sbin/nginx;; stop)kill-2`ps-ef|grep"/usr/local/webserver/nginx/sbin/nginx"|grep-v"grep"|awk'{print$2}'`;;restart)cd"$CMD"$0stop$0start;; *) echo$"Usage:$0{start|stop|restart}"exit1esac exit0 -------------------[E]url_hash转发方式nginx启动、关闭脚本[E]--------------------更改该文件权限chmodu+xnginx.sh 启动nginx./nginx.shstart 重启nginx./nginx.shrestart 关闭nginx./nginx.shstop