Articles of nginx

在另一个nginx web服务器前的nginx代理>获取正确的IP

我有一个运行在另一个nginx服务器(B)前面的nginx反向代理(服务器A)。 但是,A似乎没有正确地将IP传递给服务器B. 即使我有 proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 这些行在我的configuration。 我知道Apache只需加载RPAF模块。 有没有类似的nginx? 干杯

如何configuration/etc/nginx/nginx.conf

我正在使用Ruby on Rails上的nginx服务器,现在的问题是如何configurationnginx.conf。

免费工具从nginx访问日志中收集每日每URL统计信息

我需要分析nginx的访问日志,并以这种格式(或等效的)来提供统计信息: DD-MM-YYYY /url hits-total hits-unique 哪里唯一的命中是每ip确定的。 所有我已经检查过的日志分析解决scheme都会按照每月的粒度收集这些统计数据。 有没有一个免费的工具,可以收集我需要的统计信息?

使所有的东西去https,除了在轨道,nginx,乘客一个url

嘿,我有一个Rails应用程序,我已经redirect几乎所有stream量使用https。 但是,我的应用程序中有一个特定的path,我需要通过纯http访问,比如somedomain.com/special 。 我想知道这是甚至可能的,因为我的Rails应用程序似乎在https块中定义。 也许如果有一些方法可以在http和https上进行托pipe,那么如果不是/special话,将所有stream量从httpredirect到https? (我也需要/RPC2在http上,但这不是一个轨道path,这就是为什么现在工作)。 任何build议,我将不胜感激。 如果您在configuration中看到任何明显的错误,如果您指出这些错误,我也会很感激! server { listen 80; server_name somedomain.com; location / { rewrite ^ https://somedomain.com$request_uri? permanent; } location /RPC2 { include scgi_params; scgi_pass 127.0.0.1:5000; auth_basic "app"; auth_basic_user_file /var/www/server/basic.auth; } } server { listen 443 default ssl; server_name somedomain.com; root /var/www/sites/app/current/public; passenger_enabled on; rails_env production; ssl_certificate /etc/ssl/certs/myssl.crt; ssl_certificate_key /etc/ssl/certs/myssl.key; ssl_protocols SSLv2 […]

如何正确使用Nginx位置指令?

我试图通过在Ubuntu 10.10与Nginx的apt上安装的phpmyadmin软件包,虽然我最终得到它的工作,我不认为我做得很对: server { listen 80; ## listen for ipv4 server_name vpsnet.dev; error_log /home/robin/dev/vpsnet/error.log; access_log /var/log/nginx/vpsnet.access.log; location / { root /home/robin/dev/vpsnet/webroot; index index.php index.html; if (-f $request_filename) { break; } if (!-f $request_filename) { rewrite ^/(.+)$ /index.php?url=$1 last; break; } } location /phpmyadmin { root /usr/share; index index.php index.html; } location ~ ^/phpmyadmin/.*\.php$ { fastcgi_pass […]

将nginx设置为反向代理帮助

我是一个新的颠倒caching代理..只是想设置一个我的ssl请求,secure.mydomain主要提供txt和gz静态小(小于200K)的文件。 任何帮助将不胜感激。 我目前的nginx.conf: http : //pastebin.com/xcS6bH3B

如何在nginx的目录下使用basic auth? 并不像看起来那么容易

我有一个像这样的结构的网站: www.example.org – 如果你得到/你得到一个WordPress的CMS www.example.org/wiki – 一个mediawiki www.example.org/project – projectpier 我想要www.example.org/wiki和www.example.org/project需要基本authentication。 我知道如何使用基本的身份validation,但问题是nginx将匹配最具体的规则。 所以如果有一条规则是 location ~ \.php$ { 另一个是 location /wiki { 对于.php文件来说,第一个规则是匹配的,而不pipe第二条规则中的基本authentication规则如何。 其他非.php文件受到保护。 显然,这不是我想要的。 .php的位置规则是启用php-fpm。 这与apache的.htaccess完全不同,我只是在/ wiki中放置了一个.htaccess,它工作正常。 所以…我可以在nginx中完成这个吗? 或者我需要做一些事情,如安装wiki.example.org和project.example.org DNS别名/虚拟服务器,并以这种方式进行pipe理? 看起来这么简单,似乎还有很长的一段路要走……一定有一些显而易见的事情,我错过了,而那些聪明的绘制服务器故障的人会马上指出。 提前致谢!

什么是这个设置最好的networking服务器configuration?

我有一台运行在IBM刀片上的networking服务器,硬件configuration是: Intel Xeon E5506 x 2 (8 cores) 12G mem SAS disk raid1 我使用这个盒子作为一个专门的networking服务器提供十几个简单的PHP脚本。 他们做mysql查询并返回结果代码。 没有图片,没有静态文件。 mysql服务器在本地运行。 目前我正在使用apache2。 目的是为了尽可能多的客户,因为我可以使用这个服务器。 我想知道什么是以下configuration参数的最佳值: MinSpareServers MaxSpareServers MaxClients 我也想切换到Nginx + PHP FastCGI。 如果我使用这种types的设置,我应该如何configuration: how many fastcgi processes how many worker_processes worker_connections 请根据您的经验给出您的build议。 谢谢!

redirectnginx根目录到其他url?

我服务器与Nginx的静态文件。 我想做什么,当有人浏览 http://foo.bar.com/ 他被redirect到 http://bar.com 但是当我访问静态文件本身时,它应该服务该文件,如: http://foo.bar.com/blog/main.css 有什么build议? 谢谢!

带有nginx前端反向代理的virtualmin面板上的Apache2,FastCGI,PHP-FPM,APC

我的梦想设置:在Apache2上的PHP 5.3.6 + MySQL 5.5.10,FastCGI,PHP-FPM,APC与nginx 1.0前端反向代理。 而作为免费的服务器pipe理面板:Virtualmin GPL on centos 5.6 在新的centos 5.6设置。 使用这个代码来安装virtualmin: wget http://software.virtualmin.com/gpl/scripts/install.sh chmod +x install.sh ./install.sh 安装后,我看到PHP是5.1和MySQL是5.0版本。 而系统不支持php-fpm,但支持fcgid包装。 我做了以下更改: wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-6.ius.el5.noarch.rpm wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-1-1.ius.el5.noarch.rpm rpm -Uvh ius-release*.rpm epel-release*.rpm yum install yum-plugin-replace yum remove mysql.i386 yum replace mysql –replace-with mysql55 service mysqld restart chkconfig mysqld on mysql_upgrade –password=1234 yum replace php –replace-with php53u […]