nginx+php使用相对路径的问题求解
时间:2009-05-25
来源:互联网
本帖最后由 joyanhui 于 2009-5-25 11:47 编辑
在nginx下的html目录 很正常[code]server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}[/code]上级目录为何只解析html不解析php?[code]
server {
listen 8081;
server_name localhost;
location / {
root ../htdocs;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root ../htdocs;
}
location ~ \.php$ {
root ../htdocs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
[/code]
在nginx下的html目录 很正常[code]server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}[/code]上级目录为何只解析html不解析php?[code]
server {
listen 8081;
server_name localhost;
location / {
root ../htdocs;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root ../htdocs;
}
location ~ \.php$ {
root ../htdocs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
[/code]
作者: joyanhui 发布时间: 2009-05-25
location ~ \.php$ {
root ../htdocs;#这里 为什么不能用相对路径?
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
root ../htdocs;#这里 为什么不能用相对路径?
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
作者: joyanhui 发布时间: 2009-05-25
你自己不是已经回答了吗
root ../htdocs;#写法错误,本应该连HTML都解析不了的,具体原因,你可以自己分析NGINX代码,它是开源的。
root ../htdocs;#写法错误,本应该连HTML都解析不了的,具体原因,你可以自己分析NGINX代码,它是开源的。
作者: xieaotian 发布时间: 2009-05-26
相对目录 应该如何写?
我要是能分析ningx源码 就不会在这里问啦,晕菜了
我要是能分析ningx源码 就不会在这里问啦,晕菜了
作者: joyanhui 发布时间: 2009-05-27
我也测试过这个问题,没有成功,暂时得出的结论是不支持,继续关注
作者: peacock 发布时间: 2009-05-27
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28