Alias or Symlink help?

adam estes wtymdjs at gmail.com
Tue Mar 6 01:49:32 UTC 2012


I want to create a link so /video will pull from somewhere other then
the document root.

I would just move this over, but this have dynamic files of multiple
gb that I need to load, so its easier to leave them there.

First I tired using alias

location /video/ {
    alias /home/documents/;
}

location ~ ^/video/(.+\.php)$ {
    alias /home/documents/$1;
    fastcgi_pass   unix:/tmp/phpfpm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $request_filename;

    # From fastcgi_params
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      /home/documents; # <-- Changed
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;
    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $server_name;
    fastcgi_param  REDIRECT_STATUS    200;
}

That only gives me a "No file specified" message when accessing php.

I then tried a sym link instead (Obviously removing those lines from conf

ls -s /home/documents/ /home/sites/domain/basketballiq/video/

Html file will load properly, but php gives me a 502.

What do I do? :(



More information about the nginx mailing list