Nginx Question

April 23, 2014 1.5k views
I setup a VPS running the Ghost application using the pre-made offering. How can I setup Nginx to serve up a plain http directory for images and misc files that aren't part of the Ghost blog? Everything I do results in a Ghost 404 page not found error.
3 Answers
You could try setting up a PHP server with tasksel and create an image folder and serv files through there. https://gist.github.com/nahtnam/8092251 Im not sure it would work though.
Edit it the file "/etc/nginx/conf.d/default.conf" and add a new location block so that it looks like:


server {
listen 80;
server_name my-ghost-blog.com ;

client_max_body_size 10M;

location / {
proxy_pass http://localhost:2368/;
proxy_set_header Host $host;
proxy_buffering off;
}

location /files {
root /var/www;
}
}


Then create a directory named "/var/www/files" Now any files that you put in that directory will be available at: http://yourdomain.com/files/yourfile.ext
Thanks, that worked perfectly!
Have another answer? Share your knowledge.