月度归档: 2017 年 9 月
在 CentOS6.5 上搭建代理服务器 TinyProxy
一、吐槽 国庆了,抢票回家,从 9 月 1 号开始各种抢票软件挂着,到现在一点动静都没有,任你快速告诉急速光速抢票都没有一点屁用,全都是忽悠人的!!!特别是这个携程旅行,妈的挂了三个星期抢了快一百万次了,和没抢一样,要你何用???? 二、 12306Bypass 换个抢票软件,看到了个 12306Bypass, ... 阅读更多
MongoDB 在 windows 和 linux 环境下的安装
一、概述 搭建 leaote 服务器用到了 MongoDB,以前从来没接触过这个数据库,不过好在网上教程多,安装也不复杂,很快就安装好了,就是语法和 mysql 完全不一样有点习惯,看了半天教程还是有点懵逼,难用!! //搭好了,有时间了再写吧,搞了两天 supervisor 和 nginx,有点累! 二、 Lin ... 阅读更多
nginx 学习篇:nginx 的配置文档
一、概述 二、 nginx 配置 nginx 的配置文件位于/usr/local/nginx/conf/nginx.conf,根据安装位置的不同而不同,也有可能在/etc/nginx/nginx.con,打开文件:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
[root@localhost conf]# cat /usr/local/nginx/conf/nginx.conf #user root; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/conf/*.conf; include mime.types; default_type application/octet-stream; #log_format main "$remote_addr - $remote_user [$time_local] "$request" " # "$status $body_bytes_sent "$http_referer" " # ""$http_user_agent" "$http_x_forwarded_for""; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass https://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache"s document root # concurs with nginx"s one # #location ~ /.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } |
一共分为六 ... 阅读更多
godoc 的 web 版本开启方式
一、摘要 godoc 是 go 默认自带的一个模块,提供了 go 语言的文档相关信息,一般情况下查询文档可以使用 godoc **来进行查询。 例如 godoc fmt,就会出现 fmt 包相关的信息: 二、 WEB 版文档 其实对大部分人来说,命令行界面看起来都是不友好的,满屏的黑屏白字就算是程序员也是会有抵触心理。 ... 阅读更多
windows 查看 dns 列表和刷新 dns 缓存的方法
一、查看 dns 记录 windows 中查看 dns 缓存命令 ipconfig /displaydns,在 cmd 命令行界面直接输入即可 二、刷新 dns 缓存 dns 一般由服务商提供,但有时候我们也会通过修改 hosts 文件来得到 dns 记录,但是修改 hosts 文件后 dns 不会立马生效,一般需要重启才能生效。 重启 ... 阅读更多
nginx 学习篇:添加 nginx 到开机自启
创建文件/etc/init.d/nginx,把脚本复制进去,nginx 官方启动脚本:nginx 官方脚本地址
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
#!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # description: NGINX is an HTTP(S) server, HTTP(S) reverse # proxy and IMAP/POP3 proxy server # processname: nginx # config: /etc/nginx/nginx.conf # config: /etc/sysconfig/nginx # pidfile: /var/run/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/etc/nginx/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx make_dirs() { # make required directories user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed "s/[^*]*--user=([^ ]*).*/1/g" -` if [ -n "$user" ]; then if [ -z "`grep $user /etc/passwd`" ]; then useradd -M -s /bin/nologin $user fi options=`$nginx -V 2>&1 | grep "configure arguments:"` for opt in $options; do if [ `echo $opt | grep ".*-temp-path"` ]; then value=`echo $opt | cut -d "=" -f 2` if [ ! -d "$value" ]; then # echo "creating" $value mkdir -p $value && chown -R $user $value fi fi done fi } start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac |
需要修改的两个地方:
|
1 2 3 |
# nginx 程序目录 # nginx="/usr/sbin/nginx" nginx="/usr/local/nginx/sbin/nginx" |
[crayon-694b ... 阅读更多
nginx 学习篇:nginx 安装
一、摘要 nginx 安装有三种方式: 1 、配置 yum 安装:这个需要先配置好 yum 软件包,然后使用 yum install nginx 命令安装。 2 、源码安装:去官网下载源码,自行编译安装。 3 、使用第三方提供的安装包:如 lnmp 一键安装包,简单操作就能一键配置。 这里我使用的是第二种方式,从源码安装。 ... 阅读更多
修改 CentOS6 系的 yum 源
一、概述 默认情况下 CentOS 的 yum 源是国外的,所以使用 yum 安装软件的时候就需要很久,这时候可以把默认的 yum 源替换成国内的源,这样下载速度就会快很多了。 二、步骤
|
1 2 3 4 5 6 7 8 9 10 11 |
# 备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak # 下载 wget https://mirrors.163.com/.help/CentOS6-Base-163.repo # 网易源 # 如果提示 wget 命令找不到,使用以下命令 # curl https://mirrors.163.com/.help/CentOS6-Base-163.repo > /etc/yum.repos.d/CentOS-Base.repo # 替换 mv CentOS6-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo # 删除和更新缓存 yum clean all yum makecache |
添加阿里云源 [crayon-694b343d9e213620 ... 阅读更多
CentOS 最小化安装后无网络连接的处理办法
问题描述 在虚拟机上最小化安装了一个 CentOS6.5,然后登陆上去的时候没有网络连接,使用 ifconfig 命令查看到的状态信息: 没有 eth0,也就没有网卡启动。 解决方法 手动启动网卡,使用命令:ifup eth0 开机自启 上面手动开启网卡之后,一旦系统关机或者重启,网卡就关闭,这样每次开机都 ... 阅读更多