I have a site that I've moved into a BOA server that has some custom scripts for an outside application. They need the app folder accessible through the domain name: e.g. example.com/customscript/ and be able to run PHP.

I think once I figure out where to put a custom vhost I'd only need to add a location directive like the one below. Does that look correct?

server {
  location /customscript {
    root /data/disk/o1/static/customscript;
    index  index.php
  }
}

My question is where can I add this custom vhost if the site is hosted inside of Aegir? Do Nginx vhosts cascade or override if I have an extra config somewhere else?

Thanks!

CommentFileSizeAuthor
install.log_.txt6.81 KBjeremyr
barracuda.cnf_.txt1.39 KBjeremyr
barracuda_log.txt419 bytesjeremyr

Comments

omega8cc’s picture

Status: Active » Closed (works as designed)

Please read and follow the docs first. You should *not* add a server {} section there, just a custom location, like we do for other exceptions in the standard configuration. This should do the trick:

###
### Allow custom PHP in this subdirectory, but serve also any static files.
###
location ^~ /customscript {
  location ~* ^.+\.(?:css|js|htc|xml|jpe?g|gif|png|ico|bmp|svg|swf|pdf|docx?|xlsx?|tiff?|txt|rtf|cgi|bat|pl|dll|aspx?|class|otf|ttf|woff|eot|less)$ {
    add_header  Access-Control-Allow-Origin *;
    access_log off;
    expires 30d;
    tcp_nodelay off;
    try_files $uri =404;
  }
  location ~* ^/customscript/.*\.php$ {
    tcp_nopush   off;
    keepalive_requests 0;
    try_files    $uri =404;
    fastcgi_pass 127.0.0.1:9000; ### or 9090 for PHP 5.3
  }
  rewrite ^/$ /customscript/index.php last;
}
jeremyr’s picture

Thanks! I think that did the trick.