nginx

How do I convert an Apache rewrite rule to an nginx rewrite rule?

In apache have the following rewrite rule: RewriteCond %{REQUEST_URI} ^/(lar)/(.*)/(\d{6})(\d)(\d)(\d)(\d)(\d)(\d).jpg$ RewriteRule ^/(lar)/(.*)/(\d)(\d)(\d)(\d)(\d)(\d).jpg$ /$4/$5/$6/%7/%8/%9/%6%7%8%9.jpg How do I write the same rewrite rule in Nginx? ...

simulate heroku on local (nginx + rails 3 app)

Hi, I am trying to simulate heroku on my local since our app is on heroku. I don't have access to the app in heroku though, so I just plan in recreating the same environment heroku has in implementing SSL for our app. Anyway, I searched heroku and based on my findings and assumptions, they are using nginx. I am using WEBrick right now a...

Why does nginx + memcache corrupt my response body?

I'm caching some web pages in memcache. When I read the page directly from the cache, the page is well formed like this ... !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"-:-- 0 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> ...

ensuring dynamic image urls in a web-app: use a blob store?

I want to serve images in a web-app using sessions such that the links to the images expire once the session has expired. If I show the actual links to the filesystem store of the images, say http://www.mywebapp.com/images/foo1.jpg this clearly makes stopping future requests for the image (one the user has signed out of the session) dif...

nginx multi-stage 404 handling

We just moved to a new site, and want to redirect old links where necessary - however, some still work. For instance, /holidays/sku.html still works, while /holidays/christmas/ no longer works. I'd like to be able to allow the site to attempt to serve a page, and when a 404 is reached, THEN try to pass it through a series of regex ...

Nginx not serving css and JS from CDN

Hi, I use a CDN to serve js and css files.. when I open the file from the cdn, directly from the browser , its opening , but the same file when included in the php script is not able to use it.. I just migrated from Apache to Nginx..I donnt what the error is ..but I can see 404 errors.. I have not altered any dns settings.. ...

Regular expression to match "wap" not preceeded by "html"

Hey, I'm using NGINX to segment mobile traffic between a mobile WAP/HTML site. Looks like the best way to do this is going to be to check the UA's preference for content by checking the HTTP Accept Header. A preference for WAP is indicated by the appearance of a 'wap' mimetype in the header before an 'html' or wildcard mimetype. So a ...

Why PMP (poor man's profiler) don't work on nginx?

There is one very useful gdb "script" called poor man's profiler. It calls this command: gdb -ex "set pagination 0" -ex "thread apply all bt" --batch -p $pid It works well for most linux processes, but don't work for nginx web server. Normal output: # gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p 5286 Using host lib...

How can I use django's built-in server behind nginx?

I'm developing with apache2 ( mpm-worker ) + mod_wsgi behind nginx which is silly since I have to sudo apache2ctl graceful for every update I make in anything but the template files. My nginx conf is: server { listen 80; server_name site.org; access_log /www/site.org/log/access.log; error_log /www/site...

Code for Nginx rewrite rules for serving .html in Drupal on Aegir folder

I have a Drupal website at www.domain.com Typically, Drupal stores files in www.domain.com/files. I have newsletter archives in http://www.domain.com/files/outreach/newsletter_templates. When a user goes to http://www.domain.com/outreach I would like it to show the content of /files/outreach/../.. Can this be done with rewrite rules, ...

Nginx map Subdomain to different IP Address

Hi, What I actually want to do is map my subdomain e.g sub.domain.com to a different IP address. I was actually asked to create a CName record and point it to someothersite.com but this isnt working for me so I was thinking how can I do it from Nginx in such a way that the domain name stays the same sub.domain.com even when the user is b...

nginx reverse proxy

Hey guys, I'm trying to have /blog redirecting to blog.mysubdomain.com Here's the location part in my nginx conf : location /blog { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect false; proxy_pass http://blog.letitcast.com;...

how to properly register nginx header filter?

I'm writing an nginx module. From looking at other examples I'm registering my header filter in my modules postconfiguration hook: static ngx_int_t mod_py_postconfig(ngx_conf_t *cf) { ngx_http_next_header_filter = ngx_http_top_header_filter; ngx_http_top_header_filter = mod_py_headers_filter; return NGX_OK; } But the handl...

How can I selectively clear the cache for Sinatra + Nginx + Phusion Passenger?

I have a modular Sinatra app running on nginx with Phusion Passenger. When I alter my app (and in particular, some YAML files which are used to generate pages), I'd like to be able to clear only the parts of my cache that are affected (and leave evertyhing else in /public alone--I know I can just clean out the whole cache, but I was hop...

multiple HTTP GET requests in one TCP/IP connection - processed parallel or sequential

hi, ok we get a lot of googlebot requests. googlebot requests up to 11 different files via 11 HTTP GET request, all in one single TCP/IP connection. are these GET request (all in the same TCP/IP connection) processed via the server in parallel or in sequence? Or is it up the the server? in this case, how does nginx handle thi...

Rails MultiSite App + nginx config

I'm trying to deploy a multisite Rails app with different views and public folders for each site. Let's say that we have www.foo.com and www.bar.com. Inside my RAILS_ROOT directory I have a [sites] directory with two folders inside [foo] and [bar] each folder consists of a [public] and [views] folder. My nginx configuration has to be so...

using ngnix infront of node.js

I am using ngnix infront of 4 instances of node.js apps running on 1 machine (quad core), can any ngnix experts give me any advice on how to configure this to get the most out of the web app. I am using connect/express frameworks on node and I think they allow smart caching etc, but I am not sure which bits to let ngnix do and which bits...

Mono MVC 2 home route doesn't work

I'm trying to convert an ASP .NET MVC 2 app to run on nginx/mono 2.8. So far it seems to work quite well except that the default route doesn't work when the path is empty. I am proxying all requests through to the fastcgi server and I get served up with an ASP .NET 404 not found page. i.e. This doesn't work http://mysite.com But this...

How to change/add ports in apache2, in debian?

My OS: Linux version 2.6.26-2-xen-686 (Debian 2.6.26-25lenny1) ([email protected]) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Fri Sep 17 00:54:08 UTC 2010 On my VPS, I need to use both php and ruby. So I want to use apache to handle my php sites and nginx for the ruby sites. And pass the php request to apache thro...

How do I redirect https:// requests to http:// in NGINX?

Is there a way to redirect https:// requests to http:// by adding a rule in the domain's vhost file? I'm using NGINX. ...