Solved

Aliased directories in NGINX and APACHE

Posted on 2011-09-10
4
709 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now