1.安装说明:
系统情况:Ubuntu 14.04.3 LTS
序列号 | 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 | 立即申请 |
软件:nginx-1.8.0.tar.gz
安装位置:/opt/nginx
2.安装
需要用到的安装包:
openssl-fips-2.0.10.tar.gz
zlib-1.2.8.tar.gz
pcre-8.37.tar.gz
nginx-1.8.0.tar.gz
安装顺序依次为:openssl、zlib、pcre,然后安装Nginx包
2.1安装openssl-fips-2.0.2.tar.gz
tar –zxvf openssl-fips-2.0.10.tar.gz
cd openssl-fips-2.0.10
./config
make
make install
2.2 安装zlib-1.2.8.tar.gz
tar –zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install
2.3安装pcre-8.37.tar.gz (需安装编译c++情况: apt-get install build-essential)
在安装pcre-8.37.tar.gz之前需要安装c++编译情况,不然在执行./configure时会报错。
apt-get install build-essential
tar –zxvf pcre-8.37.tar.gz
cd pcre-8.37
./configure
make
make install
2.4安装nginx-1.8.0.tar.gz
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --with-pcre=../pcre-8.37 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-fips-2.0.10
make
make install
至此Nginx的安装完成!
检测nginx是否安装乐成
cd /usr/local/nginx/sbin
./nginx –t
呈现如下所示提示,暗示安装乐成
[email protected] :/usr/local/nginx/sbin# ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
启动nginx
./ngixn
查察端口:
netstat -tnlp | grep nginx
[email protected] :/usr/local/nginx/sbin# netstat -tnlp | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2957/nginx
而且通过欣赏器会见
3.nginx负载平衡设置
打开 /usr/local/nginx/conf/nginx.conf 设置文件,,做如下设置即可:
userrootroot;worker_processes1;#error_loglogs/error.log;#error_loglogs/error.lognotice;error_loglogs/error.logwarn;pidlogs/nginx.pid;events{worker_connections1024;}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"';#access_loglogs/access.logmain;sendfileon;#tcp_nopushon;#keepalive_timeout0;keepalive_timeout65;#gzipon;#设定负载平衡的处事器列表upstreammyserver{server192.168.1.171:8080;server192.168.1.172:8080;server192.168.1.173:8080;}#侦听处事器信息server{listen80;server_name192.168.1.110;#charsetkoi8-r;#access_loglogs/host.access.logmain;location/{#roothtml;#indexindex.htmlindex.htm;proxy_passhttp://myserver;proxy_redirectoff;proxy_set_headerHost$host;proxy_set_headerX-Real-IP$remote_addr;#后端的Web处事器可以通过X-Forwarded-For获取用户真实IPproxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;}#error_page404/404.html;#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html;location=/50x.html{roothtml;}#proxythePHPscriptstoApachelisteningon127.0.0.1:80##location~.php${#proxy_passhttp://127.0.0.1;#}#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000##location~.php${#roothtml;#fastcgi_pass127.0.0.1:9000;#fastcgi_indexindex.php;#fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;#includefastcgi_params;#}#denyaccessto.htaccessfiles,ifApache'sdocumentroot#concurswithnginx'sone##location~/.ht{#denyall;#}}#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration##server{#listen8000;#listensomename:8080;#server_namesomenamealiasanother.alias;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}#HTTPSserver##server{#listen443ssl;#server_namelocalhost;#ssl_certificatecert.pem;#ssl_certificate_keycert.key;#ssl_session_cacheshared:SSL:1m;#ssl_session_timeout5m;#ssl_ciphersHIGH:!aNULL:!MD5;#ssl_prefer_server_cipherson;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}}