# 掃描指定目錄的檔案
# include vhost/*.conf;
log_format domaintradefork '$remote_addr - $remote_user [$time_local] $request ''$status $body_bytes - $remote_user [$time_local] $request ''$status $body_bytes_smage_fward;
伺服器
{
聽80;
server_name domaintradefork.dev.bizcn.com mingfork.dev.bizcn.com;
.htm default.php;
root /home/domaintradefork/htdocs;
if (!-e $request_filename) {
1 s =$1 最後;
重寫 ^/(.*)$ /index.php?s=$1 最後;
}
最後;
}
php5) ?$
{
try_files $uri =404;
fast? index.php;
# ------ -- --------------------------
# include fastcgi_pathinfo.conf;
# --------- -- -----------------------
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
RIP 是需要註解掉的,請注意
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_ $ request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT protocol;
fastcgi_param HTTPS $https if_not_empty; fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_name;
#定義變數$path_info ,用於儀表路徑資訊資訊
set $path_info "";
#設定變數$real_script_name,用於儀表真實位址
5如果地址與帳篷內部的正規表示式相符
if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
_name $1;
#將檔案位址後的參數賦予變數$path_info
set $path_info $2;
}
#配置fastcgi的某些參數
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;<_5_b8_filename path_info> }
location ~ .*.(gif| jpg|jpeg|png|bmp|swf)$
{
expires 30d; expires 12h;
}
access_log /home/domaintradefork/logfiles/access.log domaintradefork;
}
以上就介紹了 nginx配置,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。