How to configure the phpinfo mode function when nginx is enabled under linux or windows
This article mainly introduces "how to configure the function of phpinfo mode on nginx under linux or windows". In the daily operation, I believe that many people have doubts about how to configure the function of phpinfo mode enabled by nginx under linux or windows. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to configure the function of phpinfo mode on nginx under linux or windows". Next, please follow the editor to study!
The copy code is as follows:
Location ~\ .php (. *) ${
Fastcgi_pass unix:/tmp/php-cgi.sock
Fastcgi_index index.php
Fastcgi_split_path_info ^ (. +\ .php) (. *) $
Fastcgi_param script_filename $document_root$fastcgi_script_name
Fastcgi_param path_info $fastcgi_path_info
Fastcgi_param path_translated $document_root$fastcgi_path_info
# include fastcgi_params
Include fcgi.conf
}
An example of a complete site configuration:
The copy code is as follows:
Log_format v.lzw.me'$remote_addr-$remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent" $http_x_forwarded_for'
Server {
Listen 80
Server_name v.lzw.me
Index index.html index.htm index.php default.html default.htm default.php
Root / www/v.lzw.me
# urlrewrite
Include v.lzw.me.conf
Location ~\ .php (. *) ${
Fastcgi_pass unix:/tmp/php-cgi.sock
Fastcgi_index index.php
Fastcgi_split_path_info ^ (. +\ .php) (. *) $
Fastcgi_param script_filename $document_root$fastcgi_script_name
Fastcgi_param path_info $fastcgi_path_info
Fastcgi_param path_translated $document_root$fastcgi_path_info
# include fastcgi_params
Include fcgi.conf
}
Location. *\. (gif | jpg | jpeg | png | bmp | swf) ${
Expires 30d
}
Location. *\. (js | css)? ${
Expires 12h
}
Access_log / wwwlogs/v.lzw.me.log v.lzw.me
}
Refer to other methods (suitable for nginx under windows, etc.):
The copy code is as follows:
Location\ .php
{
Fastcgi_pass 127.0.0.1:9000
Fastcgi_index index.php
Include fcgi.conf
Set $real_script_name $fastcgi_script_name
If ($fastcgi_script_name ~ "^ (. +?\ .php) (/. +) $") {
Set $real_script_name $1
Set $path_info $2
}
Fastcgi_param script_filename $document_root$real_script_name
Fastcgi_param script_name $real_script_name
Fastcgi_param path_info $path_info
}
At this point, the study on "how to configure the phpinfo mode function on nginx under linux or windows" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!