在CentOS7(mini)上安装:

  1. [root@~ localhost]#lftp 172.16.0.1
  2. lftp 172.16.0.1:/pub/Sources/7.x86_64/nginx> pwd
  3. ftp://172.16.0.1/pub/Sources/7.x86_64/nginx
  4. #偶数版本号为稳定版
  5. lftp 172.16.0.1:/pub/Sources/7.x86_64/nginx> get nginx-1.10.2-1.el7.ngx.x86_64.rpm nginx-module-geoip-1.10.2-1.el7.ngx.x86_64.rpm
  6. 670448 bytes transferred
  7. Total 2 files transferred
  8. [root@~ localhost]#ls
  9. anaconda-ks.cfg nginx-1.10.2-1.el7.ngx.x86_64.rpm nginx-module-geoip-1.10.2-1.el7.ngx.x86_64.rpm
  10. [root@~ localhost]#yum install ./nginx-1.10.2-1.el7.ngx.x86_64.rpm
  11. #80端口没启动,即可启动Nginx
  12. [root@~ localhost]#ss -ntl
  13. [root@~ localhost]#systemctl start nginx.service

  1. [root@etc localhost]#cd /etc/nginx/
  2. [root@nginx localhost]#vim nginx.conf
  3. [root@nginx localhost]#cd conf.d/
  4. [root@conf.d localhost]#ls
  5. default.conf
  6. [root@conf.d localhost]#vim test.conf
  7. server {
  8. listen 8080;
  9. server_name www.magedu.com;
  10. location / {
  11. index index.html index.htm;
  12. root /data/www;
  13. }
  14.  
  15. }
  16.  
  17. [root@conf.d localhost]#nginx -t
  18. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  19. nginx: configuration file /etc/nginx/nginx.conf test is successful
  20. #重载
  21. [root@conf.d localhost]#nginx -s reload
  22. [root@conf.d localhost]#mkdir -pv /data/www
  23. mkdir: created directory ‘/data
  24. mkdir: created directory ‘/data/www
  25. [root@conf.d localhost]#vim /data/www/index.html
  26.  
  27. <h1>test page</h1>
  28. [root@conf.d localhost]#ss -ntl
  29. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  30. LISTEN 0 128 *:8080 *:*

动态装载动态模块:

  load_module files;

  1. #动态装载Geoip模块
  2. [root@~ localhost]#yum -y install ./nginx-module-geoip-1.10.2-1.el7.ngx.x86_64.rpm
  3. #查看安装完成生成的文件
  4. [root@~ localhost]#rpm -ql nginx-module-geoip
  5. /usr/lib64/nginx/modules/ngx_http_geoip_module-debug.so
  6. /usr/lib64/nginx/modules/ngx_http_geoip_module.so #此文件是需要加载的模块
  7. /usr/share/doc/nginx-module-geoip
  8. /usr/share/doc/nginx-module-geoip/COPYRIGHT
  9. #编辑主配置文件,将需要加载的文件放到全局配置中(main配置)
  10. [root@~ localhost]#vim /etc/nginx/nginx.conf
  11. error_log /var/log/nginx/error.log warn;
  12. pid /var/run/nginx.pid;
  13.  
  14. load_module /usr/lib64/nginx/modules/ngx_http_geoip_module.so; #装载模块
  15.  
  16. #配置文件语法检查
  17. [root@~ localhost]#nginx -t
  18. #重载
  19. [root@~ localhost]#nginx -s reload

性能优化的相关配置:

  1. #进程数量和进程绑定CPU
  2. [root@~ localhost]#vim /etc/nginx/nginx.conf
  3. user nginx;
  4. worker_processes 4; #按CPU的颗数-lscpu
  5. #将worker进程绑定在指定的CPU上
  6. worker_cpu_affinity 0001 0010 0100 1000;
  7. [root@~ localhost]#nginx -t
  8. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  9. nginx: configuration file /etc/nginx/nginx.conf test is successful
  10.  
  11. #将进程没有绑定在CPU和绑定进行压测
  12. #没有绑定CPU
  13. [root@nginx localhost]#vim nginx.conf
  14. worker_processes 4;
  15. #worker_cpu_affinity 0001 0010 0100 1000;
  16. [root@nginx localhost]#nginx -t
  17. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  18. nginx: configuration file /etc/nginx/nginx.conf test is successful
  19. [root@nginx localhost]#nginx -s reload
  20. #检测
  21. #-n:每0.5秒检测一次
  22. #psr:运行进程的CPU
  23. [root@nginx localhost]#watch -n 0.5 'ps axo pid,comm,psr|grep "nginx"'
  24.  
  25. Every 0.5s: ps axo pid,comm,psr|grep "nginx" Mon Jun 5 13:59:29 2017
  26.  
  27. 20628 nginx 0
  28. 20766 nginx 3
  29. 20767 nginx 1
  30. 20768 nginx 0
  31. 20769 nginx 0
  32.  
  33. #另一台服务器测试:
  34. [root@~ localhost]#yum -y install httpd-tools
  35. #-n:发起的请求数
  36. #-c:并发数
  37. [root@~ localhost]#ab -n 100000 -c 20 http://172.16.250.89/index.html
  38.  
  39. Benchmarking 172.16.250.89 (be patient)
  40. Completed 10000 requests
  41. Completed 20000 requests
  42. Completed 30000 requests
  43. Completed 40000 requests
  44. Completed 50000 requests
  45. Completed 60000 requests
  46. Completed 70000 requests
  47. Completed 80000 requests
  48. Completed 90000 requests
  49. Completed 100000 requests
  50. Finished 100000 requests
  51.  
  52. Document Path: /index.html
  53. Document Length: 612 bytes
  54.  
  55. Concurrency Level: 20
  56. Time taken for tests: 189.948 seconds
  57. Complete requests: 100000
  58. Failed requests: 0
  59. Write errors: 0
  60. Total transferred: 84500000 bytes
  61. HTML transferred: 61200000 bytes
  62. Requests per second: 526.46 [#/sec] (mean)
  63. Time per request: 37.990 [ms] (mean)
  64. Time per request: 1.899 [ms] (mean, across all concurrent requests)
  65. Transfer rate: 434.43 [Kbytes/sec] received
  66.  
  67. Connection Times (ms)
  68. min mean[+/-sd] median max
  69. Connect: 1 16 6.9 16 423
  70. Processing: 2 21 9.4 20 552
  71. Waiting: 0 15 8.9 15 407
  72. Total: 6 37 13.7 36 652
  73.  
  74. Percentage of the requests served within a certain time (ms)
  75. 50% 36
  76. 66% 37
  77. 75% 39
  78. 80% 40
  79. 90% 43
  80. 95% 46
  81. 98% 53
  82. 99% 77
  83. 100% 652 (longest request)
  84.  
  85. #进程绑定CPU:
  86. [root@nginx localhost]#vim nginx.conf
  87. user nginx;
  88. worker_processes 4;
  89. worker_cpu_affinity 0001 0010 0100 1000;
  90.  
  91. [root@nginx localhost]#watch -n 0.5 'ps axo pid,comm,psr|grep "nginx"'
  92. [root@nginx localhost]#vim nginx.conf
  93. [root@nginx localhost]#nginx -t
  94. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  95. nginx: configuration file /etc/nginx/nginx.conf test is successful
  96. [root@nginx localhost]#nginx -s reload
  97. [root@nginx localhost]#watch -n 0.5 'ps axo pid,comm,psr|grep "nginx"'
  98.  
  99. Every 0.5s: ps axo pid,comm,psr|grep "nginx" Mon Jun 5 14:03:10 2017
  100.  
  101. 20628 nginx 0
  102. 23847 nginx 0
  103. 23848 nginx 1
  104. 23849 nginx 2
  105. 23850 nginx 3
  106.  
  107. #压测:
  108. [root@~ localhost]#ab -n 100000 -c 20 http://172.16.250.89/index.html
  109.  
  110. Benchmarking 172.16.250.89 (be patient)
  111. Completed 10000 requests
  112. Completed 20000 requests
  113. Completed 30000 requests
  114. Completed 40000 requests
  115. Completed 50000 requests
  116. Completed 60000 requests
  117. Completed 70000 requests
  118. Completed 80000 requests
  119. Completed 90000 requests
  120. Completed 100000 requests
  121. Finished 100000 requests
  122.  
  123. Document Path: /index.html
  124. Document Length: 612 bytes
  125.  
  126. Concurrency Level: 20
  127. Time taken for tests: 186.953 seconds
  128. Complete requests: 100000
  129. Failed requests: 0
  130. Write errors: 0
  131. Total transferred: 84500000 bytes
  132. HTML transferred: 61200000 bytes
  133. Requests per second: 534.89 [#/sec] (mean)
  134. Time per request: 37.391 [ms] (mean)
  135. Time per request: 1.870 [ms] (mean, across all concurrent requests)
  136. Transfer rate: 441.39 [Kbytes/sec] received
  137.  
  138. Connection Times (ms)
  139. min mean[+/-sd] median max
  140. Connect: 1 17 4.9 16 194
  141. Processing: 3 20 6.6 19 308
  142. Waiting: 0 14 5.7 14 204
  143. Total: 12 37 9.9 35 457
  144.  
  145. Percentage of the requests served within a certain time (ms)
  146. 50% 35
  147. 66% 37
  148. 75% 38
  149. 80% 39
  150. 90% 43
  151. 95% 48
  152. 98% 55
  153. 99% 66
  154. 100% 457 (longest request)

配置文件中映射目录测试:

  1. [root@images localhost]#vim /etc/nginx/conf.d/test.conf
  2. server {
  3. listen 8080;
  4. server_name www.magedu.com;
  5. location / {
  6. index index.html index.htm;
  7. root /data/www;
  8. }
  9. location /images/ { #此处的路径实际上是/data/pictures/images;
  10. root /data/pictures/;
  11. }
  12.  
  13. }
  14.  
  15. [root@images localhost]#nginx -t
  16. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  17. nginx: configuration file /etc/nginx/nginx.conf test is successful
  18. [root@images localhost]#nginx -s reload
  19. [root@images localhost]#mkdir /data/pictures
  20. [root@images localhost]#cd /data/pictures
  21. [root@pictures localhost]#ls
  22. [root@pictures localhost]#mkdir images
  23. [root@pictures localhost]#ls
  24. images
  25. [root@pictures localhost]#cd images/
  26. [root@images localhost]#ls
  27. tulips.jpg
  28. [root@images localhost]#pwd
  29. /data/pictures/images
  30. [root@images localhost]#ls
  31. tulips.jpg

  1. #将root换成alias时
  2. [root@pictures localhost]#vim /etc/nginx/conf.d/test.conf
  3. [root@images localhost]#cd /data/pictures/
  4. [root@pictures localhost]#ls
  5. images lighthouse.jpg
  6. [root@pictures localhost]#vim /etc/nginx/conf.d/test.conf
  7. server {
  8. listen 8080;
  9. server_name www.magedu.com;
  10. location / {
  11. index index.html index.htm;
  12. root /data/www;
  13. }
  14. location /images/ {
  15. alias /data/pictures/;        #别名,实际上相当于/images/与/data/pictures同级
  16. }
  17.  
  18. }
  19. [root@pictures localhost]#nginx -t
  20. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  21. nginx: configuration file /etc/nginx/nginx.conf test is successful
  22. [root@pictures localhost]#nginx -s reload

没有location的测试:

  1. [root@conf.d localhost]#pwd
  2. /etc/nginx/conf.d
  3. [root@conf.d localhost]#vi test2.conf
  4. server {
  5. listen 8088; #开启8088端口
  6. root /data/www2;
  7. server_name www2.magedu.com;
  8. }
  9.  
  10. [root@conf.d localhost]#nginx -t
  11. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  12. nginx: configuration file /etc/nginx/nginx.conf test is successful
  13. [root@conf.d localhost]#nginx -s reload
  14. [root@conf.d localhost]#mkdir /data/www2
  15. [root@conf.d localhost]#vim /data/www2/index.html
  16. <h1>www2</h1>

错误页面的重定向:

  1. [root@conf.d localhost]#cat test2.conf
  2. server {
  3. listen 8088;
  4. server_name www2.magedu.com;
  5. #错误页面定位到如下路径;即在/data/www2/下得有这个图片文件
  6. error_page 404 http://172.16.250.89:8088/error.jpg;
  7. location / {
  8. root /data/www2;
  9.  
  10. }
  11. }
  12. [root@www localhost]#cd /data/www2/
  13. [root@www2 localhost]#ls
  14. error.jpg images index.html

输入http://172.16.250.89:8088/index2.html:

用Telnet测试keepalive:

  1. [root@conf.d localhost]#cat test2.conf
  2. server {
  3. listen 8088;
  4. server_name www2.magedu.com;
  5. error_page 404 =200 http://172.16.250.89:8088/error.jpg;
  6. keepalive_timeout 60; #60s后断开长连接
  7. keepalive_requests ; #在单个长连接上最多响应10个资源
  8. location / {
  9. root /data/www2;
  10.  
  11. }
  12. }
  13.  
  14. [root@~ localhost]#telnet 172.16.250.89 8088 #指明ip和端口
  15. Trying 172.16.250.89...
  16. Connected to 172.16.250.89.
  17. Escape character is '^]'.
  18. GET /index.html HTTP/1.1   #Telnet测试语法
  19. Host: 172.16.250.89
    Connection closed by foreign host. #超过60s自动断开长连接

basic认证:

  1. [root@nginx localhost]#vim /etc/nginx/conf.d/test.conf
  2.  
  3. server {
  4. listen 8080;
  5. server_name www.magedu.com;
  6. location / {
  7. index index.html index.htm;
  8. root /data/www;
  9. }
  10. location /images/ {
  11. alias /data/pictures/;
  12. }
  13. location /bbs/ {
  14. root /data/; #需要认证的文件
  15. auth_basic "BBS internal"; #认证说明
  16. auth_basic_user_file /etc/nginx/.ngxpasswd; #认证文件
  17. }
  18. }
  19. #安装httpd-tools使用htpasswd生成认证文件和用户
  20. [root@nginx localhost]#yum -y install httpd-tools
  21. [root@nginx localhost]#htpasswd -c -m /etc/nginx/.ngxpasswd tom
  22. #-c:创建认证文件
  23. #-m:md5的算法加密
  24. [root@nginx localhost]#htpasswd -m /etc/nginx/.ngxpasswd jerry
  25. [root@nginx localhost]#nginx -t
  26. [root@nginx localhost]#nginx -s reload
  27. [root@nginx localhost]#mkdir /data/bbs
  28. [root@nginx localhost]#vim /data/bbs/index.html
  29. <h1>FBI area</h1>

输入tom 和密码:

输出stub_status:

  1. [root@nginx localhost]#vim /etc/nginx/conf.d/test.conf
  2. location /ngxstatus {
  3. stub_status;
  4. }
  5. [root@nginx localhost]#nginx -t
  6. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  7. nginx: configuration file /etc/nginx/nginx.conf test is successful
  8. [root@nginx localhost]#nginx -s reload

启用压缩功能:

  1. [root@nginx localhost]#vim nginx.conf
  2. gzip on; #启用压缩
  3. [root@nginx localhost]#nginx -t
  4. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  5. nginx: configuration file /etc/nginx/nginx.conf test is successful
  6. [root@nginx localhost]#nginx -s reload
  7. [root@www localhost]#curl -I --compressed http://172.16.250.89:8080/access_log.html
  8. HTTP/1.1 200 OK
  9. Server: nginx/1.10.2
  10. Date: Wed, 14 Jun 2017 13:13:19 GMT
  11. Content-Type: text/html
  12. Last-Modified: Wed, 14 Jun 2017 12:43:59 GMT
  13. Connection: keep-alive
  14. ETag: W/"59412f8f-14ea216"
  15. Content-Encoding: gzip #已压缩
  16.  
  17. [root@nginx localhost]#vim nginx.conf
  18. gzip on;
  19. gzip_types text/css text/plain application/javascript;
  20. gzip_comp_level 5; #压缩比
  21. gzip_min_length 64; #启用压缩的最小长度
  22. [root@nginx localhost]#nginx -t
  23. [root@nginx localhost]#nginx -s reload

ngx_http_rewrite_module:

  1. [root@conf.d localhost]#vim test.conf
  2. error_page 404 =200 /images/error.jpg;
  3. location / {
  4. index index.html index.htm;
  5. root /data/www;
  6. if ($http_user_agent ~* curl) {
  7. rewrite ^(.*)$ /curl/$1; #curl测试重定向
  8. }
  9. }
  10. location /curl/ {
  11. alias /data/textagent; #curl重定向后的文件路径,需要手动创建
  12. }
  13. #对error_page做重定向,到百度首页,临时的重定向(redirect:302)
  14. location = /images/error.jpg {
  15. rewrite ^(.*)$ http://www.baidu.com/ redirect;
  16. }
  17. #新疆curl重定向的页面
  18. [root@conf.d localhost]#cd /data/
  19. [root@data localhost]#cat textagent/index.html
  20. <h1>hello,this is rewrite page</h1>
  21.  
  22. [root@conf.d localhost]#nginx -t
  23. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  24. nginx: configuration file /etc/nginx/nginx.conf test is successful
  25. [root@conf.d localhost]#nginx -s reload

测试效果:

输入:

ngx_http_referer_module:防盗链机制;

  1. [root@conf.d localhost]#cat test.conf
  2. #在浏览器非手动键入网址访问或者referer值为空时,跳转
  3. valid_referers none blocked server_name *.magedu.com;
  4. if ($invalid_referer) {
  5. return 302 http://www.magedu.com/;
  6. }
  7. [root@~ localhost]#curl -I -e http://www.baidu.com http://172.16.250.89:8080/
  8. HTTP/1.1 302 Moved Temporarily
  9. Server: nginx/1.10.2
  10. Date: Wed, 14 Jun 2017 16:03:04 GMT
  11. Content-Type: text/html
  12. Content-Length: 161
  13. Connection: keep-alive
  14. Location: http://www.magedu.com/ #跳转到定义的网址
  15. #-I:只显示请求头信息
  16. #-e:模拟referer,从那个网址直接跳转到本网址

ngx_http_proxy_module:

  1. [root@conf.d localhost]#cat default.conf
  2. server {
  3. listen 80;
  4. server_name localhost;
  5.  
  6. #charset koi8-r;
  7. #access_log /var/log/nginx/log/host.access.log main;
  8.  
  9. location / {
  10. root /usr/share/nginx/html;
  11. index index.html index.htm;
  12. proxy_pass http://192.168.2.129:80/bbs; #此ip是被代理的主机ip
  13. }

输入:

  1. #proxy_set_header:为了让被代理的的主机能保存真正访问的信息,如访问客户端的ip信息
  2. [root@conf.d localhost]#vim default.conf
  3. location ~* \.(jpg|jpeg|gif|png)$ {
  4. proxy_pass http://192.168.2.129;
  5. proxy_set_header X-Real-IP $remote_addr;
  6. }
  7. [root@~ localhost]#nginx -t
  8. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  9. nginx: configuration file /etc/nginx/nginx.conf test is successful
  10. [root@~ localhost]#nginx -s reload
  11. #在被代理主机上设置:
  12. [root@html localhost]#vim /etc/httpd/conf/httpd.conf
  13. LogFormat "%{X-Real-IP}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  14. [root@html localhost]#httpd -t
  15. [root@html localhost]#systemctl restart httpd

  1. [root@html localhost]#tail /var/log/httpd/access_log
  2. 172.16.250.55 - - [06/Jun/2017:13:09:12 +0800] "GET /1.jpg HTTP/1.0" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
  3. 172.16.250.55 - - [06/Jun/2017:13:09:14 +0800] "GET /1.jpg HTTP/1.0" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
  4. #172.16.250.55 是访问代理主机的客户端信息

代理缓存的设置:

  1. [root@~ localhost]#cd /etc/nginx/
  2. [root@nginx localhost]#vim nginx.conf
  3. http {
  4. #定义proxy的缓存路径必须在http下
  5. #level是定义目录的格式,一级目录两个十六进制的值,二级是一个,三级是一个;keys_zone的名称是可以自由定义的,大小最大的1G
  6. proxy_cache_path /data/cache/ngnix levels=2:1:1 keys_zone=mycache:10m max_size=1g;
  7. }
  8. [root@nginx localhost]#mkdir /data/cache/ngnix -pv
  9. mkdir: created directory ‘/data
  10. mkdir: created directory ‘/data/cache
  11. mkdir: created directory ‘/data/cache/ngnix
  12. [root@nginx localhost]#vim /etc/nginx/conf.d/default.conf
  13. location ~* \.(jpg|jpeg|gif|png)$ {
  14. proxy_pass http://192.168.2.129;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. proxy_cache mycache; #引用定义的缓存
  17. proxy_cache_key $request_uri; #缓存key的内容
  18. proxy_cache_valid 200 301 302 10m; #对于特定响应码的缓存时长 m分钟 h 小时
  19. proxy_cache_valid any 1m;
  20.  
  21. }
  22.  
  23. [root@nginx localhost]#nginx -t
  24. [root@nginx localhost]#nginx -s reload

测试:

  1. [root@conf.d localhost]#ll /data/cache/ngnix/ -h
  2. total 16K
  3. drwx------ 3 nginx nginx 4.0K Jun 6 00:22 60
  4. drwx------ 3 nginx nginx 4.0K Jun 6 00:17 a4
  5. drwx------ 3 nginx nginx 4.0K Jun 6 00:22 b3
  6. drwx------ 3 nginx nginx 4.0K Jun 6 00:22 dd
  7. [root@conf.d localhost]#ll /data/cache/ngnix/60/4/c/635450b5c68b27bfaa2e0065cb86c460 -h
  1. [root@nginx localhost]#vim /etc/nginx/conf.d/default.conf
  2.  
  3. location ~* \.(jpg|jpeg|gif|png)$ {
  4. proxy_pass http://192.168.2.129;
  5. proxy_set_header X-Real-IP $remote_addr;
  6. proxy_cache mycache;
  7. proxy_cache_key $request_uri;
  8. proxy_cache_valid 200 301 302 10m;
  9. proxy_cache_valid any 1m;
  10. proxy_hide_header Server; #隐藏的是后端服务器的首部信息,而不是Nginx代理服务器的首部信息
  11. add_header X-Proxy $server_addr; #添加首部的展示信息
  12.  
  13. }

输入:

nginx的安装及基本配置的更多相关文章

  1. Nginx的安装及相关配置

    Nginx的安装及相关配置 Nginx 是 C语言 开发,建议在 Linux 上运行,当然,也可以安装 Windows 版本,本篇则使用 CentOS 7 作为安装环境. 一. gcc 安装 安装 n ...

  2. Nginx的安装及简单配置

    Nginx安装 1.下载相关组件 yum install -y gcc gcc-c++                                   #安装C/C++编译器 yum -y ins ...

  3. nginx 编译安装以及简单配置

    前言 Nginx的大名如雷贯耳,资料太多了,网上一搜一大把,所以这里就不阐述nginx的工作原理了,只是简单的编译安装nginx,然后呢,简单配置一下下. 下载Nginx.安装 下载地址:http:/ ...

  4. Ubuntu16 Nginx的安装与基本配置

    关于Nginx 它是一个轻量级.高性能.稳定性高.并发性好的HTTP和反向代理服务器,当我们搭建自己的应用时,通常用它作为反向代理服务器,图片服务器和负载均衡. 1.Ubuntu 16安装 Nginx ...

  5. java架构之路-(nginx使用详解)nginx的安装和基本配置

    Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和Unix的多用户.多任务.支持多线程和多CPU的操作系统.它能运行主要的Unix工具软件.应用程序和网络协议.它支持32位 ...

  6. Nginx 2.安装与部署配置

    转 https://www.cnblogs.com/wcwnina/p/8728430.html > 下载 官方网站:https://nginx.org/en/download.html Win ...

  7. Linux下nginx的安装以及环境配置

    参考链接 https://blog.csdn.net/qq_42815754/article/details/82980326 环境: centos7 .nginx-1.9.14 1.下载 并解压  ...

  8. Nginx服务安装配置

    1.Nginx介绍 Nginx是一个高性能的HTTP和反向代理服务器,由俄罗斯人开发的,第一个版本发布于2004年10月4日.Nginx由于出色的性能,在世界范围内受到了越来越多人的关注,其特点是占有 ...

  9. Django Nginx+uwsgi 安装配置

    使用 python manage.py runserver 来运行服务器.这只适用测试环境中使用. 正式发布的服务,我们需要一个可以稳定而持续的服务器,比如apache, Nginx, lighttp ...

随机推荐

  1. struts自定义拦截器实现

    示例 添加新功能:只有是登录的状态访问hello_loginSuccess才会显示登录成功. index.jsp登录成功页面 test.jsp登录页面 一.修改原代码实现 1.登录后将登录信息添加到S ...

  2. [原创]Scala学习:编写Scala脚本

    scala支持脚本 1)在/opt/scala-script下创建一个文件hello.scala 编辑内容如下: $ hello ,this is the first scala script 2)运 ...

  3. 《机器学习实战》学习笔记第十四章 —— 利用SVD简化数据

    相关博客: 吴恩达机器学习笔记(八) —— 降维与主成分分析法(PCA) <机器学习实战>学习笔记第十三章 —— 利用PCA来简化数据 奇异值分解(SVD)原理与在降维中的应用 机器学习( ...

  4. screen&tmux快捷键

    screen Key 快捷键 Action 动作 Notes 备注 Ctrl+a c new window 新窗口   Ctrl+a n next window 下一个窗口 I bind F12 to ...

  5. 格式化namenode时 报错 No Route to Host from node1/192.168.1.111 to node3:8485 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host

    // :: FATAL namenode.NameNode: Failed to start namenode. org.apache.hadoop.hdfs.qjournal.client.Quor ...

  6. 大话设计模式--享元模式 Flyweight -- C++实现实例

    1. 享元模式: 运用共享技术有效地支持大量细粒度的对象. 享元模式可以避免大量非常相似类的开销,在程序设计中,有时需要生成大量颗粒度的类实例来表示数据,如果能发现这些实例除了几个参数外基本都是相同的 ...

  7. hdu 4542 小明系列故事——未知剩余系 反素数 + 打表

    小明系列故事——未知剩余系 Time Limit: 500/200 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Prob ...

  8. php之打印

    echo 比较适合用来打印字符串,数字 print_r 一般打印数组 var_dump 可以打印所有类型,打印变量的类型及其值

  9. 重置 oschina 的CSS

    嗯, 目前只是改了一下OSChina的几个主要DIV宽度而以,还是很粗糙, 以后会慢慢改进的. ---------------------------------------------------- ...

  10. Codeforces 453B Little Pony and Harmony Chest:状压dp【记录转移路径】

    题目链接:http://codeforces.com/problemset/problem/453/B 题意: 给你一个长度为n的数列a,让你构造一个长度为n的数列b. 在保证b中任意两数gcd都为1 ...