• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 785
  • Last Modified:

Aliased directories in NGINX and APACHE

I want to map a virtual directory "/ftp/" to a physical one "/var/ftp/photos/" containing only static files, but all I get when accesssing "mysite.com/ftp/file.jpg" is "404 Not Found. nginx/0.8.54"
I'm using a combo of Nginx and Apache.
My settings:

nginx.conf:

    server {
        listen          80;
        access_log      /var/log/nginx/access_log;

        location / {
            proxy_pass  http://127.0.0.1:8080;
        }

        location ~* \.(htc|jpg|jpeg|gif|bmp|css|png|js|ico|txt)$ {
            root        /var/www/html;
        }

        location /ftp/ {
            alias /var/ftp/photos/;
        }
    }

httpd.conf:

Alias /ftp/ "/var/ftp/photos/"
<Directory "/var/ftp/photos">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

What should I change?
Thank you.
0
PavelTMN
Asked:
PavelTMN
  • 2
  • 2
1 Solution
 
pilson66Commented:
with this config:

1. request never comes to apache
2. request "mysite.com/ftp/file.jpg" nginx is turned to "/var/www/html/ftp/file.jpg"
3. see nginx access.log ang error.log
0
 
PavelTMNAuthor Commented:
error_log

2011/09/11 00:05:33 7921#0: *758 open() "/var/www/html/ftp/file.jpg" failed (2: No such file or directory), client: 92.240.208.166, server: , request: "GET /ftp/file.jpg HTTP/1.1", host: "mysite.com"
0
 
pilson66Commented:
maybe easier to create symlink /var/www/html/ftp --> /var/ftp/photos/

or edit regular expression to exclude /ftp/*.jpg from ~* \.(htc|jpg|jpeg|gif|bmp|css|png|js|ico|txt)$
0
 
PavelTMNAuthor Commented:
I went with a symlink.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now