Question

Nginx: setup `public_folder` to serve html and similar files?

Posted November 16, 2013 7.9k views
After installing the Ghost droplet (running Nginx) I've realised that there is no `public_folder` or `www` folder where I can drop random html files and other docs (e.g. Google Webmaster Tools domain verification file). Is anyone aware of the configuration/changes required to have a `public_folder` up and running on Nginx without affecting the security of the server?

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.

×
7 answers
You can store such files in /path/to/ghost/core/shared.
Hi Kamal,
/path/to/ghost/core/shared
doesn't work. Any files uploaded there are not public and do not show up on
domain-name.com/anyfile.html
, all you get is a 404.
"Any files uploaded there are not public..."

Then why not make it public?
Pablo: Original question "Is anyone aware of the configuration/changes required to have a `public_folder` up and running on Nginx without affecting the security of the server?"
Please pastebin your nginx virtualhost config file.

server {
listen 80;
server_name www.ghost-blog.com;
rewrite ^/(.*) http://ghost-blog.com/$1 permanent;
}

server {
root /usr/share/nginx/www;
index index.html index.htm;

server_name localhost;

location / {
try_files $uri $uri/ /index.html;
}

location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
}
@ar: Are you sure these are the only virtual host config files? There doesn't seem to be a virtual host for the ghost blog, ghost-blog.com.
Submit an Answer