Serving Static Content with Apache2

Apache2static-content

I am really new to apache2 and have previously worked with Nginx. I am trying to use alias in apache2 to serve static content. Starting off with a simple example.

I tried this out and it didn't work either. Advice?

000-default.conf:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName 13.67.35.134
    Alias /static /home/ubuntu/static
    <Directory /home/ubuntu/static/>
        Options FollowSymLinks
    </Directory>
    ProxyPass / http://127.0.0.1:5000/
</VirtualHost>

I tried it with quotes too based on this answer:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName 13.67.35.134
    Alias /static "/home/ubuntu/static"
    <Directory "/home/ubuntu/static">
        Options FollowSymLinks
    </Directory>
    ProxyPass / http://127.0.0.1:5000/
</VirtualHost>

I have logo.png located at

/home/ubuntu/static/logo.png

alias_module is enabled:

$ apache2ctl -M | grep alias
 alias_module (shared)

When I type in 13.67.35.134/static/logo.png, I get a 404, this is the
access.log

[26/Jan/2018:02:31:02 +0000] "GET /static/logo.png HTTP/1.1" 404 423 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"

Solution

Thanks @AndrewSchulman for pointing out that the Proxy Pass in my 000-default.conf file threw off the ability to access my static content.

Best Answer

Unless you have another web server running on localhost:5000 (and I don't know why you'd do that, except for testing I guess), you should remove the ProxyPass / http://127.0.0.1:5000/ directive.