linux/windows下nginx怎么开启phpinfo模式功能

发布时间:2022-04-25 15:35:32 作者:iii
来源:亿速云 阅读:177

本篇内容介绍了“linux/windows下nginx怎么开启phpinfo模式功能”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

复制代码 代码如下:

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;
}

一个完整的站点配置示例:

复制代码 代码如下:

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;
}

其他方法参考(适合windows下的nginx等):

复制代码 代码如下:

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;
}

“linux/windows下nginx怎么开启phpinfo模式功能”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

推荐阅读:
  1. Linux下Make 命令怎么用
  2. 怎么在Linux和Windows的Docker容器中运行ASP.NET Core

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux windows nginx

上一篇:nginx提示500 Internal Server Error错误怎么解决

下一篇:css3新增伪类选择器是什么

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》