Solved

Aliased directories in NGINX and APACHE

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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

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 …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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