MyBB

Recipe

server {
    server_name quantifiedselfforum.com;

    access_log logs/qsforum.access;
    error_log logs/qsforum.error error;

    root /var/www/qsforum;

    location / {
        index index.php;
    }

    # Deny access to internal files.
    location ~ /(inc|uploads/avatars) {
        deny all;
    }

    # Pass the php scripts to fastcgi server
    location ~ \.php$ {
        fastcgi_pass unix:/tmp/php.socket;
        # Necessary for php.
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        # Unmodified fastcgi_params from nginx distribution.
        include fastcgi_params;
    }

}

例えば、ユーザが有効なPHPコードを使ってアパターイメージ pic.gifをアップロードし、それを /uploades/avatars/pic.gif/foo.php で呼び出すような、潜在的なセキュリティの欠陥があります。この問題は here <pitfalls.uncontrollable_requests_to_php_>で議論されています。リンクは.phpで終わるため、NGINXはそれをPHPインタプリタに渡します。PHP はファイル /uploades/avatars/pic.gif/foo.phpを見つけることができませんが、気を利かして /uploades/avatars/pic.gif をPHPスクリプトとして実行しようとします。これを避けるには、php.iniに cgi.fix_pathinfo=0 を設定する必要があります。デフォルトでは(不運にも) cgi.fix_pathinfo=1 に設定されています。

See PHP FastCGI Example for details on creating the UNIX socket and this forum post on enabling human-understandable (aka SEO-friendly or human-readable) URLs using the Google SEO plugin.

inserted by FC2 system