密码保护:基于 CentOS6.5 搭建 leanote 私有云笔记服务
无法提供摘要。这是一篇受保护的文章。
无法提供摘要。这是一篇受保护的文章。
一、概述 location 模块是 nginx 中用的最多的,也是最重要的模块了,什么负载均衡啊、反向代理啊、虚拟域名啊都与它相关。 location 根据它字面意思就知道是来定位的,定位 URL,解析 URL,所以,它也提供了强大的正则匹配功能,也支持条件判断匹配,用户可以通过 location 指令实现 Ngi ... 阅读更多
一、概述 server 模块是 http 的子模块,它用来定一个虚拟主机,一个 server 模块主要包含一下配置:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
server { # 监听的端口 listen 8080; # 用户访问的域名,请求的 Host 字段 server_name localhost 192.168.87.131; # 主目录地址 root /home/wwwroot; # 默认的首页形式 index index.php index.html index.htm; # 字符编码 charset utf-8; # 用户的访问日志,main 表示日志的格式 # 目录需要提前创建好 access_log logs/host.access.log main; # 错误日志,error 为日志格式 # 目录需要提前创建好 error_log logs/host.error.log error; .... } |
这个配置的意思是当有用户在浏览器中输入 192.168.87.131:8080 访问主机的 8080 端口时,服务器将会返回/hom ... 阅读更多
一、吐槽 国庆了,抢票回家,从 9 月 1 号开始各种抢票软件挂着,到现在一点动静都没有,任你快速告诉急速光速抢票都没有一点屁用,全都是忽悠人的!!!特别是这个携程旅行,妈的挂了三个星期抢了快一百万次了,和没抢一样,要你何用???? 二、 12306Bypass 换个抢票软件,看到了个 12306Bypass, ... 阅读更多
一、概述 搭建 leaote 服务器用到了 MongoDB,以前从来没接触过这个数据库,不过好在网上教程多,安装也不复杂,很快就安装好了,就是语法和 mysql 完全不一样有点习惯,看了半天教程还是有点懵逼,难用!! //搭好了,有时间了再写吧,搞了两天 supervisor 和 nginx,有点累! 二、 Lin ... 阅读更多
一、概述 二、 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 是 go 默认自带的一个模块,提供了 go 语言的文档相关信息,一般情况下查询文档可以使用 godoc **来进行查询。 例如 godoc fmt,就会出现 fmt 包相关的信息: 二、 WEB 版文档 其实对大部分人来说,命令行界面看起来都是不友好的,满屏的黑屏白字就算是程序员也是会有抵触心理。 ... 阅读更多
一、查看 dns 记录 windows 中查看 dns 缓存命令 ipconfig /displaydns,在 cmd 命令行界面直接输入即可 二、刷新 dns 缓存 dns 一般由服务商提供,但有时候我们也会通过修改 hosts 文件来得到 dns 记录,但是修改 hosts 文件后 dns 不会立马生效,一般需要重启才能生效。 重启 ... 阅读更多
创建文件/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 ... 阅读更多