Question

Nginx Question

Posted April 23, 2014 2.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.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
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!
Submit an Answer