How to enable phpinfo mode function in nginx under linux/windows

WBOY
Release: 2023-05-29 09:36:17
forward
1400 people have browsed it

Copy code The 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;
#inc lude fastcgi_params;
include fcgi.conf;
}

A complete site configuration example:

Copy the code The 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;
}

Other method reference (suitable for nginx under windows, etc.):

Copy code The 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;
}

The above is the detailed content of How to enable phpinfo mode function in nginx under linux/windows. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template