- 浏览: 362332 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
xiangguiwang:
非常给力! 致敬
导出keystore私钥新法 -
harryhare:
harbey 写道写得不错。大家还可以参考一下这个文档的介绍: ...
证书链(The Certificate Chains) -
di1984HIT:
写的很好,学习了/
keyStore vs trustStore -
jackonline:
貌似不能用了
CAS客户端证书认证登录 -
harbey:
写得不错。大家还可以参考一下这个文档的介绍:http://ww ...
证书链(The Certificate Chains)
参考文章:http://www.jrrzz.net/2010/01/10/multi-host-trac-using-nginx/
我觉得多实例运行的关键点在于对 fastcgi中的script_name和path_info的理解
script_name是脚本名称,我们可以理解成应用的一个入口
path_name是传给这个入口的一个参数,是一个路径
比如在php中
http://www.test.com/index.php/foo/bar.html?c=index&m=search
这里的/index.php为script_name
/foo/bar.html为path_info
再后面的就为query_string鸟
在我们这里如果我们想这样运行多实例
http://xxx.com/trac/instance1/wiki
http://xxx.com/trac/instance2/wiki
就是使用这样的方式在运行instance1和instance2这两个trac的项目实例
那么我们就得设置/trac/instancex(x为可变的部分)为script_name
而后面的为path_info
比如这里的/wiki即为path_info
理解这点我们不难理解下面的配置文件了.
这里很欣赏nginx的配置文件的语法,弄的和脚本语言似的,有正则,有判断,有赋值
PS:为了彻底弄清楚fastcgi_split_path_info这个指令的工作原理,还去看了下nginx的源码,还好有c语言的功底.
这个没有文档的东东还真不容易找一些想知道的东西,除了看源码.
--------------------------------------------
MD 为了了解NGINX 中fastcgi_split_path_info这个指令的具体作用, 我读进了Nginx的源码src›http›modules›ngx_http_fastcgi_module.c 回复 回推 New Retweet 收藏 from Echofon2010-04-16 09:37:16
nginx fastcgi模块源码阅读:ngx_http_fastcgi_split_path_info(对应fastcgi_split_path_info 指令)这个函数将path的正则准备好到相应的结构体中 回复 回推 New Retweet 收藏 from Echofon2010-04-16 09:50:26
然后ngx_int_t ngx_http_fastcgi_path_info_variable和 ngx_http_fastcgi_script_name_variable这两个函数会解析正则并找依次取得两个group的值分别到 script_name和path_info中 回复 回推 New Retweet 收藏 from Echofon2010-04-16 09:51:47
----------------------------------------------------
下面是nginx的配置文件
user admin; worker_processes 5; #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 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 ~ ^/trac/([0-9a-zA-Z\-]*)/chrome(.*)$ { alias /home/admin/trac/$1/htdocs$2; } fastcgi_split_path_info ^(/trac/[0-9a-zA-Z\-_]*[/]*)(.*)$; location ~ /htdocs/(.*){ root /home/admin/trac; } if ($uri ~ ^/trac/([0-9a-zA-Z\-_]*).*$) { set $trac_host $1; } location ~ ^/trac/([0-9a-zA-Z\-]*)/login { auth_basic "trac"; auth_basic_user_file /home/admin/etc/trac_$trac_host.htpasswd; fastcgi_pass unix:/home/admin/run/trac_fastcgi_$trac_host.sock; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param SERVER_NAME $server_name; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param QUERY_STRING $query_string; fastcgi_param REMOTE_USER $remote_user; fastcgi_param AUTH_USER $remote_user; fastcgi_param SCRIPT_NAME /trac/$trac_host; fastcgi_param PATH_INFO /$fastcgi_path_info; fastcgi_param REMOTE_ADDR $remote_addr; } location ~ ^/trac { auth_basic "trac"; fastcgi_pass unix:/home/admin/run/trac_fastcgi_$trac_host.sock; fastcgi_param SCRIPT_NAME /trac/$trac_host; fastcgi_param PATH_INFO /$fastcgi_path_info; ## WSGI NEEDED VARIABLES - trac warns about them fastcgi_param REQUEST_METHOD $request_method; fastcgi_param SERVER_NAME $server_name; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param QUERY_STRING $query_string; fastcgi_param REMOTE_USER $remote_user; fastcgi_param AUTH_USER $remote_user; fastcgi_param REMOTE_ADDR $remote_addr; #root html; #index index.html index.htm; } location = / { index index.html } #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 http://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; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
发表评论
-
Nginx, PostgreSQL And Trac : 升级Trac
2010-04-18 00:38 2336偶然发现Trac的0.12开始支持国际化l10n,所以这无疑是 ... -
Nginx, PostgreSQL And Trac : 开工
2010-04-18 00:17 1829新建一个数据库用户,并为这个用户创建一个数据库,假设为trac ... -
Nginx, PostgreSQL And Trac : 准备工作
2010-04-18 00:02 2915本文所涉及的操作系统为Linux uname -a L ... -
Python对象体系揭秘
2010-03-08 12:24 2406Guido用C语言创造了Python,在Python的世界 ... -
如果你喜欢Python 那么你不得不知的几个开源项目
2010-03-05 00:55 586521.Trac Trac拥有强大的 ... -
Python之正则
2010-03-04 23:53 3800从学习Python至今,发现很多时候是将Python作为一种工 ... -
trac权限系统核心算法
2010-03-01 20:27 1672trac的权限系统设计的非常的巧妙,权限以{use ... -
Django之Middleware
2010-02-21 23:02 5613Middleware也就是所谓的中间件 Django的 ... -
Python 函数参数
2010-02-19 11:19 1698名词解释 写道 关键字参数:在函数调用的时候通过 ... -
python中的命名,内建数据对象
2010-02-19 11:16 1868一.命名注意点 以一个下划线作前导的说明是弱的内部使用 ... -
深入理解Python的字符编码
2010-02-18 21:03 7272在处理中文的时候,我们有时候会碰到中文乱码的问题。 究 ... -
利用Python工具转换mp3的id3信息的编码
2010-02-10 23:32 5216在使用Mac后,经常碰到这样的问题:通过Verycd下载的mp ... -
可爱的Python 读书笔记1
2010-02-09 23:01 1534一哥们买了这本书,先放我这边我就看看噢。 主要对书中的一些概 ... -
从python的yield说起
2010-02-03 20:49 10089前段时间在读trac 中wiki ... -
MoinMoin安装
2010-02-02 20:23 41802009年6月17日20:35 今天晚上研究了一下一个纯Py ...
相关推荐
报错内容:sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory 启动时如果报异常error while loading shared libraries: libpcre.so....
Nginx 是由俄罗斯工程师Igor Sysoev 开发的一个高性能Web 服务器,运行效率远超传统的Apache、Tomcat,是世界第二大Web 服务器,被国内外诸多顶级互联网公司采用。 Nginx 的一个突出特点是其灵活优秀的模块化架构,...
该文档是介绍访问应用很慢,访问Nginx时,报错:accept() failed (24 Too many open files)的解决方案,与大家共享!
《Nginx 模块开发指南:使用 C++11 和 Boost 程序库》结构严谨、脉络清晰、论述精确、详略得当,值得广大软件开发工程师、系统运维工程师和编程爱好者拥有。
Nginx 问题 之 nginx: [emerg] unknown directive "echo" in /weblogic/nginx/conf/nginx.conf:43-附件资源
:gear: 类固醇上的NGINX配置生成器 :syringe: 您将是配置NGINX服务器所需的唯一工具。 · :sparkles:NGINX不仅仅是一个网络服务器。 您可能已经知道了。 我们喜欢NGINX,因为: 内存使用率低高并发异步事件驱动架构...
#!/bin/sh # # nginx Startup script for nginx # # chkconfig: - 85 15 # processname: nginx # config: /etc/nginx/...# Short-Description: start and stop nginx ### END INIT INFO # Source function library.
NULL 博文链接:https://jackroomage.iteye.com/blog/1687401
nginx:alpine离线镜像包,使用docker load -i nginxalpine.tar
nginx -t -c F:/nginx-1.12.2/conf/nginx.conf 测试nginx配置文件是否正确 start nginx nginx -s stop nginx -s quit nginx -s reload nginx -t 修改后的hosts文件放入c:\windows\system32\drivers\etc替换以前的...
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx 解决: 1.先使用ps -e | grep nginx查看是否已经启动了nginx 2.如果没有的话则按照提示,查看0.0.0.0:80端口谁占用了,使用netstat...
简单的nginx配置文件说明,对于开发人员,了解后可以在本地自己安装一个nginx,然后配置一下就可以使用了。
这是基本图像,类似于默认的nginx图像。 它旨在用作nginx基本图像的直接替代。 此仓库中提供了最佳实践示例Nginx配置。 参见和 。 例子: # Base Nginx HTTP/3 Image FROM ranadeeppolavarapu/nginx-http3:latest...
nginx-config::gear:优化的nginx配置
Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,第一个公开版本0.1.0发布于2004年10月4日。 其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例...
对于使用Python作为开发的网站,使用了uWSCGI服务器,并且详细讲述了它的协议和使用,通过8个实例讲述了在不同情况下的使用,例如Django框架。还有Python的三种客户端:python-memcached、cmemcache和libmemcached。...
nginx.conf nginx常用配置
决战Nginx技术卷:高性能Web服务器部署与运维.pdf决战Nginx技术卷:高性能Web服务器部署与运维.pdf