A few nginx questions

Discussion in 'Server Operation' started by JACOBKELL, Jul 15, 2009.

  1. JACOBKELL

    JACOBKELL New Member

    First,for some reason virtual host which i create,i always get error
    403.I tried many things,from chowing to various owners and other,until i
    found temporal solution-i created copy of html directory(which is
    created during install and which working fine) called bla,and pointed
    domain to bla directory and then it worked.But this is problematic since
    all files are in home directory,which means i will need to copy all of
    them into /usr/local/nginx/.
    Also what is problem is with alias,i have a script which is located at
    /home/ also and that again causing that 403 error since it's not located
    in /usr/local/nginx.I tried to make it work by creating symbolic link
    but that didn't worked.Seems only solution would be to copy script to
    nginx directory which will require a lot of file editing because of
    location change.

    Also there is a problem with domain alias-*.domain.com not working at
    all,nor 1.domain.com.If i have *.domain.com instead domain.com,then i
    get 404 error on directory alias,while it works on www.

    How do i enable hotlink blank protection for images,where images can be
    loaded only by specified domains and direct access?

    And how to rewrite following apache rule:
    RewriteEngine on
    RewriteRule ^directory/(.*)$ /st/st.php?%{QUERY_STRING}
    I using latest stable version,and i think same problems was on latest
    legacy version too.

    Here is my server section of domain:
    server {
    listen 81;
    server_name www.domain.com *.domain.com ;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location / {
    root bla;
    index index.php index.html index.htm;
    }
    location /TC/ {
    alias /home/tradecontrol/client/;
    }

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root bla;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    # proxy_pass http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on
    127.0.0.1:9000
    #
    location ~ \.php$ {
    root bla;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME
    /usr/local/nginx/bla$fastcgi_script_name;
    include fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    # deny all;
    #}
    }
     

Share This Page