Solved

Aliased directories in NGINX and APACHE

Posted on 2011-09-10
4
743 Views
Last Modified: 2012-06-27
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
Comment
Question by:PavelTMN
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:pilson66
ID: 36517086
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
 
LVL 1

Author Comment

by:PavelTMN
ID: 36517146
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
 
LVL 8

Accepted Solution

by:
pilson66 earned 500 total points
ID: 36517213
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
 
LVL 1

Author Comment

by:PavelTMN
ID: 36527501
I went with a symlink.
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question