Articles of nginx

Nginx服务器匹配太多的URL

我有一个域example.com和some-example.com的“替代”。 我试图使用nginx中的简单服务器声明来将some-example.comstream量some-example.com到example.com ,如下所示: server { listen 80; server_name some-example.com; rewrite ^/(.*) http://example.com/$1 permanent; } 我不是100%确定这是否是正确的规则,但我已经在服务器上有另一个虚拟主机,这不是问题所在,但有必要了解我遇到的问题。 server { listen 8745; server_name localhost; <other stuff goes here> } 打到<my server IP>:8745将去那个虚拟主机,按预期工作。 不过我有另外一个这样的虚拟主机: server { listen 8746; server_name localhost; <other stuff goes here> } 但是,我所有的要求<my server IP>:8746命中example.com 。 我很困惑,我没有真正感到nginx,所以任何帮助,将不胜感激为什么发生这种情况。 我在一开始就提到了这个规则,因为我认为这跟这个有关。 如果需要更多信息,我可以提供。

testing我的服务器的交通高峰?

有没有可用于testing服务器可靠性的服务? 我需要检查我的服务器是否可以处理大量的stream量。 //服务器信息: 服务器在CentOS 5.3上运行Nginx 0.7.65,只提供静态文件。

nginx +乘客上的多机架应用程序,一个作为根,另一个不是… config

所以我有两个应用程序我想运行在服务器上。 一个应用程序,我想成为“默认”的应用程序 – 也就是说,所有的URL应该默认发送这个应用程序, 除了一个特定的path,让我们调用它/foo : http://mydomain.com/ -> app1 http://mydomain.com/apples -> app1 http://mydomain.com/foo -> app2 我的两个机架应用程序安装如下所示: /var /www /apps /app1 app.rb config.ru /public /app2 app.rb config.ru /public app1 -> apps/app1/public app2 -> apps/app2/public ( app1和app2是符号链接到他们各自的应用程序的公共目录)。 这是这里描述的子URI的Passenger设置: http : //www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rack_to_sub_uri 用下面的configuration我有/foo去app2: server { listen 80; server_name mydomain.com; root /var/www; passenger_enabled on; passenger_base_uri /app1; passenger_base_uri /app2; location […]

当在php.ini中编辑nginx web服务器的值时,php info不起作用

我已经安装了php,fcgi,nginx,系统运行没有问题,但问题发生在: 我更新了php.ini中的memory_limit,然后重新启动php-cgi,nginx,但是当使用phpinfo时,memory_limit不受影响。 我安装了两个新的扩展:curl和memcache,添加2行:extension = curl.so和extension = memcache.so,重新启动php-cgi和nginx,phpinfo在phpinfo中也没有显示curl和memcache的值。 所以,我该怎么办?请帮助我。

nginx文件夹redirect

我正在尝试从nginx.conf中的确切文件夹redirect 给定URL:domain.com/path1/path2/path3 redirect到:sub.domain.com/path1/path2/path3 以下是我到目前为止: location ~* ^/path1[\/?]$ { rewrite ^/(.*) http:sub.domain.com/$1 break; } 我曾与之合作过 location /path1 { rewrite ^/(.*) http:sub.domain.com/$1 break; } 这个问题是它也redirect页面像domain.com/path1moretext/sotherotherpath到sub.domain.com/path1moretext/sotherotherpath 这不是我想要的。 (必须在上面的href代码中取出“//”,因为这是我的第一篇文章,对不起)。

Nginx重写链接缩短器+ WordPress的漂亮url

好的,我通过在线浏览安装了Nginx / PHP / MySQL / WordPress,并且让我input这些重写来启用WordPress的漂亮url: if (-f $request_filename) { break; } if (-d $request_filename) { break; } rewrite ^(.+)$ /index.php?q=$1 last; error_page 404 = //index.php?q=$uri; 这包含在我的域名的虚拟主机中。 我现在想要做的是添加一些redirect/链接缩写重写,这将与我心目中的设置打好关系。 我想将“x.com/y”redirect到“x.com/script.php?id=y”,以获取我发布的所有外部链接。 WordPress的链接设置现在几乎所有的内部链接开始与“新闻”(x.com/news/post-blah,x.com/news/category/1等),但我也有一些根链接指向一些内部内容(x.com/news,x.com/start)。 我猜这会导致一些冲突。 什么是最好的方法来做到这一点? 我从来没有使用Nginx(或任何重写规则),但也许我可以区分“x.com/news”和“x.com/news/”,以使其发挥很好? 我有一个朋友在Apache中设置了这个工作版本,如果我能够再次在Nginx上获得这个版本,那将会很好。

设置nginx作为apache的代理; 一切正常,但nginx不服务媒体

我已经设置了这样的nginx代理请求和发送Django请求到Apache和服务媒体本身。 以下文件我的设置: Nginxconfiguration: /etc/nginx/nginx.conf user www-data; worker_processes 1; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on; gzip on; include /etc/nginx/sites-enabled/*; } ===== ngnix代理/etc/nginx/proxy.conf ============ proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size […]

什么是使用NginxconfigurationPHP的最佳途径

我最近听到很多关于Nginx的好消息,我想把它放在我的slicehost服务器上。 我正在修复内存,并希望得到Wordpress和wp-super-cache的configuration。 我只是想知道获取PHP设置的“推荐方式”,因为我看到很多网页说他们的方式是正确的。 如果可能请不要编译,它会使D =更新

Nginx重写到以前的目录

我试图将我的博客从blog.example.com移动到example.com/blog来做到这一点我宁愿不移动磁盘上的任何东西,所以我改变了我的nginxconfiguration文件如下: location /blog { if (!-e $request_filename) { rewrite ^.*$ /index.php last; } root /home/demo/public_html/blog.example.com/current/public/; index index.php index.html index.html; passenger_enabled off; index index.html index.htm index.php; try_files $uri $uri/ @blog; } 这工作很好,但是当我访问example.com/blog nginx寻找: /home/demo/public_html/blog.example.com/current/public/blog/index.php 代替 /home/demo/public_html/blog.example.com/current/public/index.php 有没有一种方法来放入一个重写规则,以便我可以让服务器自动取出/ blog /目录? 就像是 ? location /blog { rewrite \\blog\D \; }

多个子域的单个nginxconfiguration

我有我的网站的以下目录结构: 在/ var / WWW /站点名/子/(公共|日志) 例如/var/www/stackoverflow.com/careers/public/index.html 我可以做一个单一的通用nginxconfiguration来做到这一点? 这样每个域都映射到正确的目录? 我不想编辑我添加的每个网站的nginxconfiguration。 根域可以始终映射到www子域。