Nginxnginx[enginex]isanHTTPandreverseproxyserver,amailproxyserver,andagenericTCP/UDPproxyserver,originallywrittenbyIgorSysoev.Foralongtime,ithasbeenrunningonmanyheavilyloadedRussiansitesincludingYandex,Mail.Ru,VK,andRambler.AccordingtoNetcraft,nginxservedorproxied25.64%busiestsitesinApril2016.Herearesomeofthesuccessstories:Netflix,Wordpress.com,FastMail.FM.Thesourcesanddocumentationaredistributedunderthe2-clauseBSD-likelicense.CommercialsupportisavailablefromNginx,Inc.
序列号 | 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是一款轻量级的Web处事器/反向署理处事器及电子邮件(IMAP/POP3)署理处事器,由俄罗斯工程师IgorSysoev开拓,供俄国大型进口网站及搜索引擎Rambler利用.其源代码以BSD-like协议宣布.其特点是内存占用少,并发本领强,因此被海内许多大型网站(如京东/淘宝)回收.(主页/先容/文档).
编译安装
目次 描写 conf nginx设置文件 html 网页文件 logs nginx日志文件 sbin nginx可执行文件
/usr/local/nginx/sbin/nginx启动, Nginx默认占用80端口,可在nginx.conf中变动.
Nginx信号
关于Linux信号相关常识, 可参考系列博客Linux信号实践, 在此, 我们仅先容Nginx捕捉的几个信号.
nginxcanbecontrolledwithsignals.
信号名 浸染 TERM/INT fast shutdown QUIT graceful shutdown HUP changing configuration, keeping up with a changed time zone , starting new worker processes with a new configuration, graceful shutdown of old worker processes USR1 re-opening log files USR2 upgrading an executable file WINCH graceful shutdown of worker processes
以上信号浸染亦可通过编译出的nginx二进制文件实现:
Tostartnginx,runtheexecutablefile.Oncenginxisstarted,itcanbecontrolledbyinvokingtheexecutablewiththe-sparameter.Usethefollowingsyntax:nginx-ssignal
设置"hljs-preprocessor">#运行处事的用户及用户组#usernobody;#事情历程数(一般配置为CPU数*焦点数)worker_processes;#全局错误日志(位置/级别)#error_loglogs/ "hljs-keyword">error.log;#error_loglogs/ "hljs-keyword">error.lognotice;#error_loglogs/ "hljs-keyword">error.loginfo;#PID文件#pidlogs/nginx.pid;#事情模式及毗连数上限events{#回收epoll举办IO复用#useepoll;#单历程所答允的最大毗连数worker_connections;}http{includemime.types;default_typeapplication/octet-stream;"hljs-preprocessor">#log_formatmain'$remote_addr-$remote_user[$time_local]"$request"'"hljs-preprocessor">#'$status$body_bytes_sent"$http_referer"'"hljs-preprocessor">#'"$http_user_agent""$http_x_forwarded_for"';"hljs-preprocessor">#access_loglogs/access.logmain;#是否激活sendfile()函数sendfileon;"hljs-preprocessor">#将HTTP响应头压缩到一个包中发送,仅在sendfile开启时才气利用#tcp_nopushon;#keepalive_timeout0;keepalive_timeout;#开启gzip模块#gzipon;#设定虚拟主机,默认监听80端口,可设置多个server{listen;server_namelocalhost;#charsetkoi8-r;"hljs-preprocessor">#access_loglogs/host.access.logmain;#页面存放位置location/{#页面存放根目次roothtml;#默认页面indexindex.htmlindex.htm;}"hljs-preprocessor">#error_page404/404.html;"hljs-preprocessor">#redirectserver "hljs-keyword">errorpagestothestaticpage/50x.html#error_page/x.html;location=/x.html{roothtml;}"hljs-preprocessor">#proxythePHPscriptstoApachelisteningon127.0.0.1:80##location~.php${"hljs-preprocessor">#proxy_passhttp://127.0.0.1;#}"hljs-preprocessor">#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000##location~.php${"hljs-preprocessor">#roothtml;"hljs-preprocessor">#fastcgi_pass127.0.0.1:9000;"hljs-preprocessor">#fastcgi_indexindex.php;"hljs-preprocessor">#fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;"hljs-preprocessor">#includefastcgi_params;#}"hljs-preprocessor">#denyaccessto.htaccessfiles, "hljs-keyword">ifApache'sdocumentroot"hljs-preprocessor">#concurswithnginx'sone##location~/.ht{#denyall;#}}"hljs-preprocessor">#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration##server{#listen8000;"hljs-preprocessor">#listensomename:8080;"hljs-preprocessor">#server_namesomenamealiasanother.alias;#location/{#roothtml;"hljs-preprocessor">#indexindex.htmlindex.htm;#}#}#HTTPSserver##server{"hljs-preprocessor">#listen443ssl;"hljs-preprocessor">#server_namelocalhost;"hljs-preprocessor">#ssl_certificatecert.pem;"hljs-preprocessor">#ssl_certificate_keycert.key;"hljs-preprocessor">#ssl_session_cacheshared:SSL:1m;"hljs-preprocessor">#ssl_session_timeout5m;"hljs-preprocessor">#ssl_ciphersHIGH:!aNULL:!MD5;"hljs-preprocessor">#ssl_prefer_server_cipherson;#location/{#roothtml;"hljs-preprocessor">#indexindex.htmlindex.htm;#}#}}
Server
在Nginx内可设置虚拟主机, 只需在nginx.conf中添加一个server元素: