Question

how can I create a folder to be a sub directory on my domain

  • Posted May 21, 2014

I installed ghostblog and cannot put another folder on the /var/www to work.

eg: www.domain.com/subdirectory to be /var/www/subdirectory

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

@sergiofilhow: On the Ghost blog one-click app, the configuration is located at <code>/etc/nginx/conf.d/default.conf</code>

Thanks for your help guys. I’ve found the config file, but it didn’t work. I think that’s something related to the ghostblog config. <br> <br>Here’s the config content. <br> <br>server { <br> #listen 80; ## listen for ipv4; this line is default and implied <br> #listen [::]:80 default ipv6only=on; ## listen for ipv6 <br> <br> root /usr/share/nginx/www; <br> index index.html index.htm; <br> <br> # Make site accessible from http://localhost/ <br> server_name www.sergio.filho.org; <br> <br> location / { <br> # First attempt to serve request as file, then <br> # as directory, then fall back to index.html <br> try_files $uri $uri/ /index.html; <br> # Uncomment to enable naxsi on this location <br> # include /etc/nginx/naxsi.rules <br> } <br> <br> location /doc/ { <br> alias /usr/share/doc/; <br> autoindex on; <br> allow 127.0.0.1; <br> deny all; <br> } <br> <br> location /sites/ { <br> alias /var/www/sites; <br> try_files $uri $uri/ /index.html; <br> } <br> <br> # Only for nginx-naxsi : process denied requests <br> #location /RequestDenied { <br> # For example, return an error code <br> #return 418; <br> #} <br> <br> #error_page 404 /404.html; <br> <br> # redirect server error pages to the static page /50x.html <br> # <br> #error_page 500 502 503 504 /50x.html; <br> #location = /50x.html { <br> # root /usr/share/nginx/www; <br> #} <br> <br> # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 <br> # <br> #location ~ .php$ { <br> # fastcgi_split_path_info ^(.+.php)(/.+)$; <br> # # NOTE: You should have “cgi.fix_pathinfo = 0;” in php.ini <br> # <br> # # With php5-cgi alone: <br> # fastcgi_pass 127.0.0.1:9000; <br> # # With php5-fpm: <br> # fastcgi_pass unix:/var/run/php5-fpm.sock; <br> # fastcgi_index index.php; <br> # include fastcgi_params; <br> #} <br> <br> # deny access to .htaccess files, if Apache’s document root <br> # concurs with nginx’s one <br> # <br> #location ~ /.ht { <br> # deny all; <br> #} <br>}

It’s usually in <code>/etc/nginx/sites-enabled</code>.

I couldn’t find the config file, where can I find it?

This can be accomplished by add a new location directive to your Nginx server block. Your configuration probably looks something like this: <br> <br><pre> <br>server { <br> listen 0.0.0.0:80; <br> server_name www.domain.com; <br> <br> location / { <br> proxy_set_header X-Real-IP $remote_addr; <br> proxy_set_header HOST $http_host; <br> proxy_set_header X-NginX-Proxy true; <br> <br> proxy_pass http://127.0.0.1:2368; <br> proxy_redirect off; <br> } <br>} <br></pre> <br> <br>To direct www.domain.com/subdirectory to /var/www/subdirectory add: <br> <br><pre> <br> location /subdirectory/ { <br> alias /var/www/subdirectory/; <br> } <br></pre> <br> <br> <br>Let us know how it goes!