"
nginx配置的ci框架,端口是83
server {
listen 83;
server_name evil.qtyd.com phpStudy.net;
root "E:/evil.qtyd.com/CodeIgniter-3.1.3";
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.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;
}
location ^~ /get/ { #反向代理调试
proxy_pass http://127.0.0.1:8787/;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
现在node监听了8787端口
router.get('/get.php', function (req, res) {
console.log(req.query);
res.header("Content-Type", "application/json;charset=utf-8");
res.json(req.query);
res.end();
})
我在浏览器访问http://127.0.0.1:83/get/get.php为什么没有跳过去
""
求助..
######你监听的域名,为何用ip访问,这样根本就没走nginx
######回复 <a href=""https://my.oschina.net/u/3260405"" class=""referer"" target=""_blank"">@hdkevil : 不会啊,这俩没关系吧######回复 <a href=""https://my.oschina.net/u/2007432"" class=""referer"" target=""_blank"">@风翔飞 : proxy_pass只能设置在80端口才有用?不能吧?######回复 <a href=""https://my.oschina.net/u/3260405"" class=""referer"" target=""_blank"">@hdkevil : nginx.conf是默认的配置文件,需要在这个文件里配置才能访问其他配置文件,这个是主体######回复 <a href=""https://my.oschina.net/u/2007432"" class=""referer"" target=""_blank"">@风翔飞 : 我放在nginx.conf里可以了,原来放在vhosts.conf不行,这会有影响?######回复 <a href=""https://my.oschina.net/u/2007432"" class=""referer"" target=""_blank"">@风翔飞 : 127.0.0.1 - - [17/Feb/2017:10:55:55 +0800] "GET /get/get.php?device_port=ios HTTP/1.1" 404 583 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0###### location ~ .php(.*)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+.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; }
location ^~ /get/ { #反向代理调试
proxy_pass http://127.0.0.1:8787/;
}</code></pre>
这两块,交换下位置
######表示没用######好,我试试######
引用来自“风翔飞”的评论
你监听的域名,为何用ip访问,这样根本就没走nginx
效果算是出来了,具体的我再琢磨琢磨,谢谢
"
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。