如何制作';获取';在php项目部署的同一服务器中请求?
情况: 我使用nginx和fastcgi将我的php项目作为web服务器部署在机器a中,配置文件如下:如何制作';获取';在php项目部署的同一服务器中请求?,php,nginx,fastcgi,Php,Nginx,Fastcgi,情况: 我使用nginx和fastcgi将我的php项目作为web服务器部署在机器a中,配置文件如下: server { listen 80; server_name alpha.kimi.com; index index.html index.htm index.php; root /alidata/www/; location ~ .*\.(php|php5)?$ { #fastcgi_pass unix
server {
listen 80;
server_name alpha.kimi.com;
index index.html index.htm index.php;
root /alidata/www/;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location / {
root /www/admin/;
index index.php;
if (!-f $request_filename){
rewrite ^/(.+)$ /index.php?$1& last;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /data/log/nginx/access/output.log;
error_log /data/log/nginx/access/error.log;
}
因此,当我从本地计算机发出“获取”请求时:
curl http://alpha.kimi.com/app/redirect/taskpush?build=10&gcdata=1
将返回json
{"res":200,"msg":"success","extra":[]}
然而,当我在机器A中提出同样的请求时,它只是挂在那里,什么也没有返回。我还尝试:
curl http://localhost/app/redirect/taskpush?build=10&gcdata=1
及
都不行了。我不知道是什么问题 您需要将nginx配置为通过localhost或127.0.0.1进行监听,才能正常工作 有关完整说明,请参阅 您可以添加多个listen语句,例如:
listen localhost;
listen 127.0.0.1;
另请参见此了解更多详细信息:请参见,最后您是如何处理此问题的?
listen localhost;
listen 127.0.0.1;