nginx

Subdomains vs folders/directories

Hi all, I'm currently building a web application and I would like my users to have their own URLs to identify them. I could either do this using subdomains or using folders and am wondering what are the advantages and disadvantages of either one. I really like the folder solution because my URL mapping would be fairly easy. I have read...

How to rewrite location in nginx depending on the client-browser's language?

Hello all. How to rewrite location in nginx depending on the client-browser's language? For example: My browser accept-language is 'uk,ru,en'. When I request location mysite.org nginx must forward to mysite.org/uk How to do it? Thanks. ...

Why do Jquery Ajax/Comet page requests return empty responses while I can access them directly ?

Hi. I'm trying to write an application using ajax, with Nginx as frontend, proxying relevant requests to a little application I wrote. All it does is to epoll some sockets and use the file descriptors. Here are some code snippets : Nginx configuration : upstream cometutils { server unix:/tmp/cutil_socket; } ... location /test { pr...

How to serve Mercurial repositories in the browser correctly?

Hello. I'm setting up my freelance server which will be using Mercurial for all the version controlling. Each project will have it's own folder, with it's own repository. Which I can then clone from my home computer, work computer or any other computer by going to that particular folder. I'm wanting to serve these repositories up into ...

How to balance bandwidth load in file streaming?

Hi, when it comes to stream big files it seems like nginx 1Gbps upload throughput link is small to handle transfer data from 3-4 storage servers. The cause of my problem is bottle neck in proxy - all data go through loadbalancer. Webservers downloading files from storage and streaming files over http (now through one nginx as loadbalanc...

How i can translate uppercase to lowercase letters in a rewrite rule in nginx web server?

I need to translate the address: www.example.com/TEST in ---> www.example.com/test ...

Passenger with Nginx cannot find rails 2.3.8 gem

I have been trying to setup nginx with passenger for a few days now and keep running into problems. When I go to my Rails application with my browser it says: Missing the Rails 2.3.8 gem. Please gem install -v=2.3.8 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comme...

Distinguishing between nginx and thin

This is a newbie question around nginx and thin in the rails environment. In reading/learning on rails I frequently hear about nginx and thin being a great combination for a rails site. In reading the descriptions of each, they both describe themselves as web servers, so I'm a little confused at what the combination brings to the tabl...

How to serve RoR JS/CSS out of nginx passenger sub_uri?

Here is my config: user nobody nobody; worker_processes 2; error_log /rails/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15; passenger_ruby /usr/loca...

Will nginx+paste hold up in a production environment?

I've developed a website in Pylons (Python web framework) and have it running, on my production server, under Apache + mod_wsgi. I've been hearing a lot of good things about nginx recently and wanted to give it a try. Currently, it's running as a forwarding proxy to create a front end to Paste. It seems to be running pretty damn fast.....

nginx - 404 not found page for permalinks

Me and my friend have had a website (http://www.ferfereh.ir - sorry not english) for a year. We've been using a Linux Apache host with wordpress installed. Now suddenly all of our posts (which had a permalink structure = /%category%/%postname%.html) have broke and says: 404 Not found nginx Maybe our host provider has installed NginX. ...

Nginx offers of downoload SVG instead of showing it

I try to show SVG file in HTML or separate tab but Nginx offers me to download it. I took normal SVG file which works on another site but not in my server. Where is a problem? There is an example http://proximax.ru/media/content/final/plane2.svg Also here SVG in HTML http://proximax.ru/index/ ...

rewrite apache to nginx

this is my first time with nginx rewrite, who can help me convert those rules to nginx sintax? RewriteRule (economics|sport|gossip|aboutus)+$ index.php?section=$1 RewriteRule (register)+$ $1.php?%{QUERY_STRING} RewriteCond %{QUERY_STRING} ^p RewriteRule (economics|sport|gossip)/+$ articles.php?section=$1&%{QUERY_STRING} thank you ...

Nginx 502 Bad Gateway error ONLY in Firefox

I am running a website locally, all the traffic is routed through NGinx which then dispatches requests to PHP pages to Apache and serves static files. Works perfectly in Chrome, Safari, IE, etc. However, whenever I open the website in Firefox I get the following error: 502 Bad Gateway nginx/0.7.65 If I clear out cache and cookies, a...

Nginx proxy_pass is ignored if static file exists

I'm trying to get nginx to always proxy certain requests, even if a static file exists. I have the proxying working fine, except nginx seems to insist on serving a static version of the file even if a proxy directive has been declared. So in the config below, if a file named "/siteroot/static/members/page.html" existed, it would be (in...

remove query string key=value at webserver level (apache/nginx)

I would like to remove fb_xd_fragment from the query string and pass the rest of the request off to the application level. This is for an improved cache hit rate so doing this modification at the application level is not useful nor possible (trust me). Example of how to modify the query string using apache or nginx would be nice. Ex...

How do I get nginx and phusion passenger to maintain sessions between 2 rails instances?

I'm using nginx with phusion passenger to run a rails app on an ec2 CentOS machine. I have a pretty standard set up with nginx, rails, phusion passenger and ssl (I think). My nginx.conf is below. So far it has worked out fine except that every time 2 requests hit the server at the same time, a new rails instance is created to serve the ...

Sinatra on Nginx configuration - what's wrong?

I followed this tutorial more or less... I installed the passenger gem, executed passenger-install-ginx-module, sucessfully installed nginx and inserted this into the config: server { listen 80; server_name localhost; root /home/admin/sintest/public; # <--- be sure to point to 'public'! passenger_enabled on; } In /home/admin...

Masking / Pointing subdomain to different server and keeping same url in address

This may be a question for Server Exchange but I am starting to feel pretty cozy here and I feel like someone here will definitely know the answer. We are currently rebuilding a php site in rails and have the new site that is being rebuilt on a linode box [nginx]. The live domain lives on a slicehost box [also niginx]. Upon launch we ...

UnicodeEncodeError: 'ascii' codec can't encode character

When uploading files with non-ASCII characters I get UnicodeEncodeError: Exception Type: UnicodeEncodeError at /admin/studio/newsitem/add/ Exception Value: 'ascii' codec can't encode character u'\xf8' in position 78: ordinal not in range(128) See full stack trace. I run Django 1.2 with MySQL and nginx and FastCGI. This is a problem...