# 扫描指定目录的文件
# include vhost/*.conf;
log_format domaintradefork '$remote_addr - $remote_user [$time_local] $request ' '$status $body_bytes_sent $http_referer ' '$http_user_agent $http_x_forwarded_for';
서버
{
listen 80;
server_name domaintradefork.dev.bizcn.com mingfork.dev.bizcn.com;
index index.html index.htm index.php default.html 기본값 .htm default.php;
root /home/domaintradefork/htdocs;
if (!-e $request_filename) {
다시 쓰기 ^/index.php/(.*)$ /index.php?s =$1 last;
다시 작성 ^/(.*)$ /index.php?s=$1 last;
}
include none.conf;
위치 ~ .*.(php|php5) ?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-domaintradefork.sock;
fastcgi_index index.php;
# -------- -------------
# include fastcgi_pathinfo.conf;
# ----------- -----------------------
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SCRIPT_NAME $fastcgi_script_name; 에디토리얼 fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $ request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
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;
#정수수량 $path_info ,용于存放pathinfo信息
set $path_info "";
#정수 $real_script_name ,용于存放真实地址
set $real_script_name $fastcgi_script _name;
#如果地址与引号内的正则表达式匹配
if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
#将文件地址赋值给变weight $real_script_name
$real_script_name $1 설정;
#将文件地址后的参数赋值给变weight $path_info
set $path_info $2;
}
#fastcgi의 일부 매개변수 구성
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path _info;
}
위치 ~ .*.(gif | jpg|jpeg|png|bmp|swf)$
{
30d;
}
위치 ~ .*.(js|css)?$
{
12시간 만료;
}
access_log /home/domaintradefork/logfiles/access.log domaintradefork;
}
위 내용은 관련 내용을 포함하여 nginx 구성을 소개하고 있으니 PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되었으면 좋겠습니다.