nginx

rights to serve files from a folder nginx & auth_basic

Hello nginxers, I have a folder F with several html files A.html B.html C.html index.html They are auto generated python doc by sphinx. I would like my url /foo to show B.html unrestricted but everything else should prompt for a password using auth_basic "Restricted". So far i tried the following without success location /foo { ...

Converting apache rewrite rules to nginx

Hello, I want to convert a few apache rules to nginx. Here are the apache rules: deny from 127.1.1.4 deny from 127.1.1.1 RewriteEngine on RewriteRule ^$ /cgi-bin/index.cgi [L] RewriteRule ([0-9A-Za-z]{12})-del-([0-9A-Za-z]+)/.+$ /cgi-bin/index.cgi?del=$1-$2 [L] RewriteCond %{REQUEST_FILENAME} !-f ...

Handle error 404 on nginx+apache

Hi, I have apache + nginx as proxy,in nginx.conf I have: server { listen 94.23.xx.xx:80 default; server_name proxy ; # "_" is for handle all hosts that are not described by server_name charset off; access_log off; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_ad...

Restricting file access on server with Rails Nginx and passenger

I have a Rails application (with Nginx and Passenger) that save video files on the server. How can I restrict access to those files to logged in users with permissions to those files? I believe when I try to access a file such as www.mysite.com/videos/video1.flv it bypasses Rails correct? So Do I have to do something at Nginx level to re...

Stop NGINX from logging my IP address

I'd like to stop NGINX from logging my own IP addreess in my access.log Is this possible? I can easily do it in Apache but I haven't been able to find anything like this for NGINX. ...

expires max caches ajax

Using rails nginx with passenger. I put the following in the nginx.conf file for caching images, js. etc. But now I notice that my ajax calls are cached or rather the expiration is set to some 30 years in future. I would like to have the javascripts cached but not the ajax calls. How do I do it? location ~* ^.+.(jpg|jpeg|gif|png|css|js|...

Nginx doesn't stop or restart

CentOS. service nginx stop/restart - does not work. it just continuing putting points (a progress bar), like this: Stopping nginx:........ [ OK ] and that's all. 'nginx -t' shows positive result. btw, restart worked till some moment ...

Locations and NginX

Hi, I want an Nginx server to just serve some memcached data, and so I have set up my location like this: location /special_data/ { set $memcached_key my_memcached_key; memcached_pass 127.0.0.1:11211; default_type text/html; } But visiting my site at the /special_data/ path gi...

How to supress known warnings when building Nginx on Linux?

I am a linux amateur and am trying to build nginx on Debian (Lenny) for the first time. Attemps to build nginx are failing and I receive the known warnings on sys_errorlist and sys_nerr as documented here: http://nginx.org/en/docs/sys_errlist.html The documentation suggests this is a warning that I can ignore. My question is what fl...

Shimmie2 on nginx (Rewrite)

Hello guys, I'm porting the rewrite rules of shimmie2 to nginx and ran across a problem: From the first impression it worked quite well, but when you try to view the image (I mean via right-click menu in your browser) you end up with stuff like this, instead the original image: ÿØÿà�JFIF��H�H��ÿÛ�C� ÿÛ�CÿÀ���À�ÿÄ�����������...

nginx rewrite for clean urls

What I'm trying to accomplish, is to have people who go to: http://www.mydomain.com/$SEARCH-QUERY/$PAGE-NUMBER to redirect to search.php?query=SEARCH-QUERY&page=PAGE-NUMBER I just figured out how to install nginx and configure php-fpm, mysql and everything, but now I'm a bit confused over the rewrites. Here's what I have, that doesn't a...

nginx passenger expires max cached pages

I have posted another question similar to this, which I thought I resolved. But it is coming back with another symptom. I am using REE/Passenger/Nginx and have the following in my nginx.conf location ~* ^.+.(jpg|jpeg|gif|png|css|js|swf)?([0-9]+)?$ { expires max; passenger_enabled on; } Ever since I did this, it seems ...

Apache with two urls and two different SSL certificates

I will ask this with an example - I have a setup, nginx, django, apache ( nginx forwards ssl requests to apache) I have website https://www.xyz.com which has a ssl certificate associated with it and clients use it when connecting. Lets say, I have another domain name www.abc.com, which I want to assign it to the same server as xyz.com ...

Nginx + PHP-FPM 502 Bad Gateway

I am getting a 502 Bad Gateway from Nginx on a line of PHP-code that is working fine in other places of my program ("$this->provider = new OAuthProvider();"), and that have worked fine before. This is the message I get in the Nginx error log for each 502: recv() failed (104: Connection reset by peer) while reading response header from up...

One rails application for multiple domain names

I have one rails application needed to be deployed by passenger module nginx. This application needs to be served for hundred domain names. I don't have enough memory to launch hundred rails instances. I'm not sure the proper way to launch rails in few instances. It's the same application under different domain names. server { list...

Make nginx with ruby on rails have case insensitive URLs

We are using nginx + passenger and Ruby on Rails. We would like all URLs, not just controllers and actions to be cases insensitive. This works fine by default on the Mac I'm developing on but when we moved to linux with its case sensitive file system, we have a bunch of broken images. I'd also just like URLs in general to be case inse...

Restrict file access with nginx and javascript

I have several javascript projects served by nginx. The project directory is structured as this way: images/, javascripts/, css/, and index.html. On the production server, I combine and minify all js and css files (app_min.js & app_min.css) into only two files. However, I want to restrict all files (except images directory, app_min.js, a...

nginx and apache web servers

This question is not nginx vs apache. I am more interested in the architectural advantages of NGinx over Apache. As I was able to understand - nginx is an asynchronous, event-driven, web-server which outperforms Apache by a huge margin. Why is this? Where does Apache fall behind? ...

nginx error " 504 Gateway Timeout"

Hi, i run wordpress on nginx, when i post a comment for my post, i get this error "504 Gateway Timeout" with nginx, can anybody tell me how to get rid of this error? Thank you! ...

Best practices for displaying a webpage in different languages

I would like to deploy a webpage in different languages (German and English). As a backend solution I would use Wordpress running on a nginx/PHP/MySQL stack on Linux. From various posts here I think that looking at the browser locale (the ACCEPT-LANGUAGE field in HTTP request) is a good first try for setting the correct language. Of cou...