?
Solved

Aliased directories in NGINX and APACHE

Posted on 2011-09-10
4
Medium Priority
?
766 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

800 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