zabbix.php访问不了

阅读: 评论:0

zabbix.php访问不了

zabbix.php访问不了

配置Nginx连接php

注:zabbix工具链接: 密码: c9jg

一、Nginx连接php

1、准备测试php文件

站点创建

# mkdir -p /data/site/huotouyihao/

存放Nginx日志

#mkdir -p /data/logs/nginx

#vi /data/site/huotouyihao/info.php

phpinfo();

?>

保存退出

2、配置Nginx

# cd /usr/local/nginx-1.8.1/conf

# f

代码如下:

server {

listen       80;

server_name  localhost;

#charset koi8-r;

#access_log logs/host.access.log  main;

access_log /data/logs/nginx/nginxaccess.log ;

index index.php index.html index.html;

root /data/site/huotouyihao;

location / {

#    root   html;

#    index  index.html index.htm;

try_files $uri $uri/ /index.php?$args;

}

location ~ .*.(php)?$

{

expires -1s;

try_files $uri =404;

fastcgi_split_path_info ^(.+.php)(/.+)$;

include fastcgi_params;

fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_pass 127.0.0.1:9000;

}

下面测试也可以:

(代码:如下

#gzip on;

server {

listen       80;

server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

access_log  /data/logs/nginx/nginxaccess.log;

index index.phpindex.html;

location / {

#    root  html;

#    index index.html index.htm;

try_files $uri$uri/ /index.php?$args;

}

location ~ .php${

root html;

fastcgi_pass127.0.0.1:9000;

fastcgi_indexindex.php;

includefastcgi_params;

fastcgi_paramSCRIPT_FILENAME /usr/local/nginx/html(注意前面目录是用户自定义的数据目录)$fastcgi_script_name;

}

#error_page  404              /404.html;

# redirect servererror pages to the static page /50x.html

#

error_page   500 502 503 504  /50x.html;

location =/50x.html {

root   html;

}

)

3、重新启动Nginx服务

#/usr/local/nginx-1.8.1/sbin/nginx -sreload

4、测试localhost/info.php

5、注意服务器本机防火墙策略

本文发布于:2024-01-31 06:50:55,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170665505626397.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:zabbix   php
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23