centos 6.9 使用yum 安装 Nginx1.12.1

Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,第一个公开版本0.1.0发布于2004年10月4日。

其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。2011年6月1日,nginx 1.0.4发布。

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。

Nginx官网:http://nginx.org/

Nginx中文手册:http://www.nginx.cn/doc/

一、安装前准备

1.安装PCRE

PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。

PCRE被广泛使用在许多开源软件之中,最著名的莫过于Apache HTTP服务器和PHP脚本语言、R脚本语言,此外,正如从其名字所能看到的,PCRE也是perl语言的缺省正则库。

官网:http://www.pcre.org/

[root@001 ~]# yum install pcre-devel pcre -y

2.安装

OpenSSL 是一个安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。#nginx加密主要是依赖openssl

官网:https://www.openssl.org/

[root@001 ~]# yum install openssl openssl-devel -y

3.安装编译器

GCC(GNU Compiler Collection,GNU编译器套件),是由 GNU 开发的编程语言编译器。它是以GPL许可证所发行的自由软件,也是 GNU计划的关键部分。GCC原本作为GNU操作系统的官方编译器,现已被大多数类Unix操作系统(如Linux、BSD、Mac OS X等)采纳为标准的编译器,GCC同样适用于微软的Windows。GCC是自由软件过程发展中的著名例子,由自由软件基金会以GPL协议发布。

[root@001 ~]# yum install gcc gcc-c++ -y

[root@001 ~]# yum install wget -y

4.添加用户

[root@001 ~]# useradd nginx -s /sbin/nologin -M

(关闭防火墙及selinux)

二、安装 Nginx

[root@001 ~]# wget http://nginx.org/download/nginx-1.12.1.tar.gz

[root@001 ~]# tar xf nginx-1.12.1.tar.gz -C /usr/local/src/

[root@001 ~]# cd !$

[root@001 src]# cd nginx-1.12.1

[root@001 nginx-1.12.1]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module

--配置参数说明:

--prefix=/usr/local/nginx #安装路径

--user=nginx #进程用户

--group=nginx #进程组

--with-http_ssl_module #激活状态信息

--with-http_stub_status_module #激活ssl功能 ---更多参数详解见文章尾部

--查看编译参数使用 -V:

[root@001 sbin]# ./nginx -V

nginx version: nginx/1.12.1

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)

built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module

[root@001 nginx-1.12.1]# make && make install

[root@001 nginx-1.12.1]# cd /usr/local/nginx/sbin/

[root@001 sbin]# ./nginx #启动

#无报错则编译安装成功

三、将nginx加入到系统环境变量及service方式管理服务

1.将nginx加入到系统环境变量
[root@001 sbin]# vim /etc/profile    #在/etc/profile 中加入如下内容
  1. export NGINX_HOME=/usr/local/nginx
  2. export PATH=$PATH:$NGINX_HOME/sbin
[root@001 sbin]# source /etc/profile    #执行 source /etc/profile ,使配置文件生效。

[root@001 sbin]# nginx -s stop  #停止服务

[root@001 sbin]# nginx   #启动服务

2.创建脚本把Nginx加为系统服务使其内使用(service nginx start/stop/restart)

[root@001 sbin]# vim /etc/init.d/nginx

  1. #!/bin/bash
  2. # nginx Startup script for the Nginx HTTP Server
  3. # it is v.0.0. version.
  4. # chkconfig: -
  5. # description: Nginx is a high-performance web and proxy server.
  6. # It has a lot of features, but it's not for everyone.
  7. # processname: nginx
  8. # pidfile: /var/run/nginx.pid
  9. # config: /usr/local/nginx/conf/nginx.conf
  10. nginxd=/usr/local/nginx/sbin/nginx #/注意你安装nginx是否这个路径
  11. nginx_config=/usr/local/nginx/conf/nginx.conf #/注意你安装nginx是否这个路径
  12. nginx_pid=/log/nginx/nginx.pid #/注意你安装nginx是否这个路径
  13. RETVAL=
  14. prog="nginx"
  15. # Source function library.
  16. . /etc/rc.d/init.d/functions
  17. # Source networking configuration.
  18. . /etc/sysconfig/network
  19. # Check that networking is up.
  20. [ ${NETWORKING} = "no" ] && exit
  21. [ -x $nginxd ] || exit
  22. # Start nginx daemons functions.
  23. start() {
  24. if [ -e $nginx_pid ];then
  25. echo "nginx already running...."
  26. exit
  27. fi
  28. echo -n $"Starting $prog: "
  29. daemon $nginxd -c ${nginx_config}
  30. RETVAL=$?
  31. echo
  32. [ $RETVAL = ] && touch /var/lock/subsys/nginx
  33. return $RETVAL
  34. }
  35. # Stop nginx daemons functions.
  36. stop() {
  37. echo -n $"Stopping $prog: "
  38. killproc $nginxd
  39. RETVAL=$?
  40. echo
  41. [ $RETVAL = ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
  42. }
  43. # reload nginx service functions.
  44. reload() {
  45. echo -n $"Reloading $prog: "
  46. #kill -HUP `cat ${nginx_pid}`
  47. killproc $nginxd -HUP
  48. RETVAL=$?
  49. echo
  50. }
  51. # See how we were called.
  52. case "$1" in
  53. start)
  54. start
  55. ;;
  56. stop)
  57. stop
  58. ;;
  59. reload)
  60. reload
  61. ;;
  62. restart)
  63. stop
  64. start
  65. ;;
  66. status)
  67. status $prog
  68. RETVAL=$?
  69. ;;
  70. *)
  71. echo $"Usage: $prog {start|stop|restart|reload|status|help}"
  72. exit
  73. esac
  74. exit $RETVAL

[root@001 sbin]# chmod -R 755 /etc/init.d/nginx   #现在就可以使用service来关闭或开启服务

 =========================到这Nginx安装完成 =========================

四、部署基于域名、ip、端口测试站点

Nginx目录下的目录说明:

1.创建两个站点目录

[root@001 ~]# mkdir /usr/local/nginx/html/www

[root@001 ~]# mkdir /usr/local/nginx/html/bbs

2.编辑Nginx 配置文件

[root@001 ~]# egrep -v "#|^$" /usr/local/nginx/conf/nginx.conf.default > /usr/local/nginx/conf/nginx.conf #去掉配置文件注释与空行

3.基于域名站点目录

[root@001 conf]# vim /usr/local/nginx/conf/nginx.conf

修改如下内容:

worker_processes 1;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {

listen 80;

server_name www.test.com; #站点域名

location / {

root html/www; #站点目录

index index.html index.htm;

}

}

添加:

server {

listen 80;

server_name bbs.test.com; #站点域名

location / {

root html/bbs; #站点目录

index index.html index.htm;

}

}

}

[root@001 html]# /usr/local/nginx/sbin/nginx -t #检查配置文件是否有错

[root@001 html]# /usr/local/nginx/sbin/nginx -s reload #重新加载配置文件

Nginx 配置文件详解:http://www.cnblogs.com/imweihao/p/7486668.html

[root@001 html]# echo "www.test.com">> www/index.html #添加测试页面

[root@001 html]# echo "bbs.test.com">> bbs/index.html #添加测试页面

[root@001 html]# vim /etc/hosts #修改hosts配置文件

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.222 www.test.com #添加

192.168.1.222 bbs.test.com #添加

[root@001 sbin]# curl www.test.com

www.test.com #测试页面正常

[root@001 sbin]# curl bbs.test.com

bbs.test.com #测试页面正常

3.基于IP或端口的虚拟测试站点

[root@001 conf]# ip addr help

Usage: ip addr {add|change|replace} IFADDR dev STRING [ LIFETIME ]

[ CONFFLAG-LIST]

ip addr del IFADDR dev STRING

ip addr {show|flush} [ dev STRING ] [ scope SCOPE-ID ]

[ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ]

IFADDR := PREFIX | ADDR peer PREFIX

[ broadcast ADDR ] [ anycast ADDR ]

[ label STRING ] [ scope SCOPE-ID ]

SCOPE-ID := [ host | link | global | NUMBER ]

FLAG-LIST := [ FLAG-LIST ] FLAG

FLAG := [ permanent | dynamic | secondary | primary |

tentative | deprecated | CONFFLAG-LIST ]

CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG

CONFFLAG := [ home | nodad ]

LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]

LFT := forever | SECONDS

[root@001 conf]# ip addr add 192.168.1.234 dev eth0 #给网卡添加IP

[root@001 conf]# ip addr del 192.168.1.234 dev eth0 #查出ip命令

编辑配置文件注:基于ip的虚拟主机只需给网卡添加ip并修改listen即可

worker_processes 1;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {

listen 192.168.1.222:800; #基于ip或端口

server_name www.test.com; #站点域名

location / {

root html/www; #站点目录

index index.html index.htm;

}

}

server {

listen 192.168.1.234:808; #基于ip或端口

server_name bbs.test.com; #站点域名

location / {

root html/bbs; #站点目录

index index.html index.htm;  #基于IP或端口

}

}

}

附:Nginx编译参数详解:

--prefix= 指向安装目录

--sbin-path 指向(执行)程序文件(nginx)

--conf-path= 指向配置文件(nginx.conf)

--error-log-path= 指向错误日志目录

--pid-path= 指向pid文件(nginx.pid)

--lock-path= 指向lock文件(nginx.lock)(安装文件锁定,防止安装文件被别人利用,或自己误操作。)

--user= 指定程序运行时的非特权用户

--group= 指定程序运行时的非特权用户组

--builddir= 指向编译目录

--with-rtsig_module 启用rtsig模块支持(实时信号)

--with-select_module 启用select模块支持(一种轮询模式,不推荐在高载环境下使用)禁用:--without-select_module

--with-poll_module 启用poll模块支持(功能与select相同,与select特性相同,为一种轮询模式,不推荐在高载环境下使用)

--with-file-aio 启用file aio支持(一种APL文件传输格式)

--with-ipv6 启用ipv6支持

--with-http_ssl_module 启用ngx_http_ssl_module支持(使支持https请求,需已安装openssl)

--with-http_realip_module 启用ngx_http_realip_module支持(这个模块允许从请求标头更改客户端的IP地址值,默认为关)

--with-http_addition_module 启用ngx_http_addition_module支持(作为一个输出过滤器,支持不完全缓冲,分部分响应请求)

--with-http_xslt_module 启用ngx_http_xslt_module支持(过滤转换XML请求)

--with-http_image_filter_module 启用ngx_http_image_filter_module支持(传输JPEG/GIF/PNG 图片的一个过滤器)(默认为不启用。gd库要用到)

--with-http_geoip_module 启用ngx_http_geoip_module支持(该模块创建基于与MaxMind GeoIP二进制文件相配的客户端IP地址的ngx_http_geoip_module变量)

--with-http_sub_module 启用ngx_http_sub_module支持(允许用一些其他文本替换nginx响应中的一些文本)

--with-http_dav_module 启用ngx_http_dav_module支持(增加PUT,DELETE,MKCOL:创建集合,COPY和MOVE方法)默认情况下为关闭,需编译开启

--with-http_flv_module 启用ngx_http_flv_module支持(提供寻求内存使用基于时间的偏移量文件)

--with-http_gzip_static_module 启用ngx_http_gzip_static_module支持(在线实时压缩输出数据流)

--with-http_random_index_module 启用ngx_http_random_index_module支持(从目录中随机挑选一个目录索引)

--with-http_secure_link_module 启用ngx_http_secure_link_module支持(计算和检查要求所需的安全链接网址)

--with-http_degradation_module  启用ngx_http_degradation_module支持(允许在内存不足的情况下返回204或444码)

--with-http_stub_status_module 启用ngx_http_stub_status_module支持(获取nginx自上次启动以来的工作状态)

--without-http_charset_module 禁用ngx_http_charset_module支持(重新编码web页面,但只能是一个方向--服务器端到客户端,并且只有一个字节的编码可以被重新编码)

--without-http_gzip_module 禁用ngx_http_gzip_module支持(该模块同-with-http_gzip_static_module功能一样)

--without-http_ssi_module 禁用ngx_http_ssi_module支持(该模块提供了一个在输入端处理处理服务器包含文件(SSI)的过滤器,目前支持SSI命令的列表是不完整的)

--without-http_userid_module 禁用ngx_http_userid_module支持(该模块用来处理用来确定客户端后续请求的cookies)

--without-http_access_module 禁用ngx_http_access_module支持(该模块提供了一个简单的基于主机的访问控制。允许/拒绝基于ip地址)

--without-http_auth_basic_module禁用ngx_http_auth_basic_module(该模块是可以使用用户名和密码基于http基本认证方法来保护你的站点或其部分内容)

--without-http_autoindex_module 禁用disable ngx_http_autoindex_module支持(该模块用于自动生成目录列表,只在ngx_http_index_module模块未找到索引文件时发出请求。)

--without-http_geo_module 禁用ngx_http_geo_module支持(创建一些变量,其值依赖于客户端的IP地址)

--without-http_map_module 禁用ngx_http_map_module支持(使用任意的键/值对设置配置变量)

--without-http_split_clients_module 禁用ngx_http_split_clients_module支持(该模块用来基于某些条件划分用户。条件如:ip地址、报头、cookies等等)

--without-http_referer_module 禁用disable ngx_http_referer_module支持(该模块用来过滤请求,拒绝报头中Referer值不正确的请求)

--without-http_rewrite_module 禁用ngx_http_rewrite_module支持(该模块允许使用正则表达式改变URI,并且根据变量来转向以及选择配置。如果在server级别设置该选项,那么他们将在 location之前生效。如果在location还有更进一步的重写规则,location部分的规则依然会被执行。如果这个URI重写是因为location部分的规则造成的,那么 location部分会再次被执行作为新的URI。这个循环会执行10次,然后Nginx会返回一个500错误。)

--without-http_proxy_module 禁用ngx_http_proxy_module支持(有关代理服务器)

--without-http_fastcgi_module 禁用ngx_http_fastcgi_module支持(该模块允许Nginx 与FastCGI 进程交互,并通过传递参数来控制FastCGI 进程工作。)FastCGI一个常驻型的公共网关接口。

--without-http_uwsgi_module 禁用ngx_http_uwsgi_module支持(该模块用来医用uwsgi协议,uWSGI服务器相关)

--without-http_scgi_module 禁用ngx_http_scgi_module支持(该模块用来启用SCGI协议支持,SCGI协议是CGI协议的替代。它是一种应用程序与HTTP服务接口标准。它有些像FastCGI但他的设计更容易实现。)

--without-http_memcached_module 禁用ngx_http_memcached_module支持(该模块用来提供简单的缓存,以提高系统效率)

-without-http_limit_zone_module 禁用ngx_http_limit_zone_module支持(该模块可以针对条件,进行会话的并发连接数控制)

--without-http_limit_req_module 禁用ngx_http_limit_req_module支持(该模块允许你对于一个地址进行请求数量的限制用一个给定的session或一个特定的事件)

--without-http_empty_gif_module 禁用ngx_http_empty_gif_module支持(该模块在内存中常驻了一个1*1的透明GIF图像,可以被非常快速的调用)

--without-http_browser_module 禁用ngx_http_browser_module支持(该模块用来创建依赖于请求报头的值。如果浏览器为modern ,则$modern_browser等于modern_browser_value指令分配的值;如果浏览器为old,则$ancient_browser等于 ancient_browser_value指令分配的值;如果浏览器为 MSIE中的任意版本,则 $msie等于1)

--without-http_upstream_ip_hash_module 禁用ngx_http_upstream_ip_hash_module支持(该模块用于简单的负载均衡)

--with-http_perl_module 启用ngx_http_perl_module支持(该模块使nginx可以直接使用perl或通过ssi调用perl)

--with-perl_modules_path= 设定perl模块路径

--with-perl= 设定perl库文件路径

--http-log-path= 设定access log路径

--http-client-body-temp-path= 设定http客户端请求临时文件路径

--http-proxy-temp-path= 设定http代理临时文件路径

--http-fastcgi-temp-path= 设定http fastcgi临时文件路径

--http-uwsgi-temp-path= 设定http uwsgi临时文件路径

--http-scgi-temp-path= 设定http scgi临时文件路径

-without-http 禁用http server功能

--without-http-cache 禁用http cache功能

--with-mail 启用POP3/IMAP4/SMTP代理模块支持

--with-mail_ssl_module 启用ngx_mail_ssl_module支持

--without-mail_pop3_module 禁用pop3协议(POP3即邮局协议的第3个版本,它是规定个人计算机如何连接到互联网上的邮件服务器进行收发邮件的协议。是因特网电子邮件的第一个离线协议标准,POP3协议允许用户从服务器上把邮件存储到本地主机上,同时根据客户端的操作删除或保存在邮件服务器上的邮件。POP3协议是TCP/IP协议族中的一员,主要用于支持使用客户端远程管理在服务器上的电子邮件)

--without-mail_imap_module 禁用imap协议(一种邮件获取协议。它的主要作用是邮件客户端可以通过这种协议从邮件服务器上获取邮件的信息,下载邮件等。IMAP协议运行在TCP/IP协议之上,使用的端口是143。它与POP3协议的主要区别是用户可以不用把所有的邮件全部下载,可以通过客户端直接对服务器上的邮件进行操作。)

--without-mail_smtp_module 禁用smtp协议(SMTP即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式。SMTP协议属于TCP/IP协议族,它帮助每台计算机在发送或中转信件时找到下一个目的地。)

--with-google_perftools_module 启用ngx_google_perftools_module支持(调试用,剖析程序性能瓶颈)

--with-cpp_test_module 启用ngx_cpp_test_module支持

--add-module= 启用外部模块支持

--with-cc= 指向C编译器路径

--with-cpp= 指向C预处理路径

--with-cc-opt= 设置C编译器参数(PCRE库,需要指定–with-cc-opt="-I /usr/local/include",如果使用select()函数则需要同时增加文件描述符数量,可以通过–with-cc- opt="-D FD_SETSIZE=2048"指定。)

--with-ld-opt= 设置连接文件参数。(PCRE库,需要指定–with-ld-opt="-L /usr/local/lib"。)

--with-cpu-opt= 指定编译的CPU,可用的值为: pentium, pentiumpro, pentium3, pentium4, athlon, opteron, amd64, sparc32, sparc64, ppc64

--without-pcre 禁用pcre库

--with-pcre 启用pcre库

--with-pcre= 指向pcre库文件目录

--with-pcre-opt= 在编译时为pcre库设置附加参数

--with-md5= 指向md5库文件目录(消息摘要算法第五版,用以提供消息的完整性保护)

--with-md5-opt= 在编译时为md5库设置附加参数

--with-md5-asm 使用md5汇编源

--with-sha1= 指向sha1库目录(数字签名算法,主要用于数字签名)

--with-sha1-opt= 在编译时为sha1库设置附加参数

--with-sha1-asm 使用sha1汇编源

--with-zlib= 指向zlib库目录

--with-zlib-opt= 在编译时为zlib设置附加参数

--with-zlib-asm= 为指定的CPU使用zlib汇编源进行优化,CPU类型为pentium, pentiumpro

--with-libatomic 为原子内存的更新操作的实现提供一个架构

--with-libatomic= 指向libatomic_ops安装目录

--with-openssl= 指向openssl安装目录

--with-openssl-opt 在编译时为openssl设置附加参数

--with-debug 启用debug日志

编译参数详解:http://blog.sina.com.cn/s/blog_68c25adf01014037.html

Nginx 配置文件详解:http://www.cnblogs.com/imweihao/p/7486668.html

centos 6.9 编译安装 Nginx1.12.1的更多相关文章

  1. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14

    准备篇: CentOS 7.0系统安装配置图解教程 http://www.osyunwei.com/archives/7829.html 一.配置防火墙,开启80端口.3306端口 CentOS 7. ...

  2. CentOS 6.6编译安装Nginx1.6.2+MySQL5.6.21+PHP5.6.3

    http://www.osyunwei.com/archives/8867.html 一.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables #编辑防火墙配置 ...

  3. CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13

    CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.132013-10-24 15:31:12标签:服务器 防火墙 file 配置文件 written 一.配置好I ...

  4. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享

    一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...

  5. CentOS 7.x编译安装Nginx1.10.3+MySQL5.7.16+PHP5.2 5.3 5.4 5.5 5.6 7.0 7.1多版本全能环境

    准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.se ...

  6. CentOS-7.3.1611编译安装 Nginx-1.12.1+mysql-5.7.19+PHP-7.1.8+zabbix-3.4.1

    CentOS-7.3.1611编译安装 Nginx-1.12.1+mysql-5.7.19+PHP-7.1.8+zabbix-3.4.1 下载软件 1.下载nginx http://nginx.org ...

  7. CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13+博客系统WordPress3.3.2

    说明: 操作系统:CentOS 6.2 32位 系统安装教程:CentOS 6.2安装(超级详细图解教程): http://www.osyunwei.com/archives/1537.html 准备 ...

  8. CentOS 7.4编译安装Nginx1.10.3+MySQL5.7.16

    准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.se ...

  9. CentOS 6.6编译安装Nginx1.6.2+MySQL5.6.21+PHP5.6.3(转)

    vi /etc/sysconfig/iptables #编辑防火墙配置文件 # Firewall configuration written by system-config-firewall # M ...

随机推荐

  1. Nginx的proxy_pass及upstream的小型负载均衡

    proxy_pass Nginx的proxy_pass将请求代理到其他的后端服务器.例如 listen 9999; server_name wyc.com; location /test/aaa { ...

  2. 新建一个兼容eclipse和myeclipse、IDEA都兼容的项目结构(maven)

    以下观点为个人理解,没实践过,后续再实现. 思路: 1.eclipse和myeclipse.IDEA这些开发工具新建的各自的项目时,都有自己的一套思路,项目结构都有各自的特点. 2.如果是这些开发工具 ...

  3. 随机取若干条记录的SQL语句

    原文:随机取若干条记录的SQL语句 MySql中随机提取数据库N条记录 select * from TableName order by rand() limit N   SQLServer中随机提取 ...

  4. 利用Yum彻底移除docker

    yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-la ...

  5. 在Centos7.x中安装psutil模块

    一.window10操作系统(Python 3.6开发环境)安装psutil 1.安装psutil模块 wget https://pypi.python.org/packages/source/p/p ...

  6. 关于各浏览器的cookie上限

    IE6~IE6以下,每个域名最多20个cookie IE7及以上,每个域名最多50个cookie Firefox,每个域名最多50个cookie Opera,每个域名最多30个cookie Safar ...

  7. python 读取CSV文件 中文乱码

    今天读取一个CSV文件,打印出来,中文显示乱码,原因是编码的缘故,CSV保存是编码格式ANSI,解决办法是以记事本方式打开CSV文件,然后另存为时编码选择UTF-8进行保存即可.

  8. KodExplorer介绍

    KodExplorer介绍 KOD·简介 官方网站https://kodcloud.com/ KodExplorer可道云,原名芒果云,是一款基于 PHP 开发的开源 WEB 网页版轻量级私有云和在线 ...

  9. 2017.7.14 使用case when和group by将多条数据合并成一行,并且根据某些列的合并值做条件判断来生成最终值

    参考来自:http://bbs.csdn.net/topics/390737006 1.效果演示 (1)不做处理 (2)合并多列,并对后四列的值做并集处理 2.SQL语句 (1)不做处理 SELECT ...

  10. C#如何改变字符串编码

    public string UTF8ToGB2312(string str)        {            try            {                    Encod ...