情况:
我在机器A中将我的php项目部署为web服务器,使用nginx和deployed,配置文件如下:
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;
}因此,当我从本地机器发出“GET”请求时,如:
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和
curl http://localhost:9000/app/redirect/taskpush?build=10&gcdata=1都不起作用。我不知道有什么问题。
发布于 2016-03-28 12:47:16
您需要将nginx配置为通过localhost或127.0.0.1侦听它才能工作。
有关完整说明,请参见module.html#listen。
您可以添加多个侦听语句,例如:
listen localhost;
listen 127.0.0.1;有关更多细节,请参见以下内容:https://serverfault.com/questions/655067/is-it-possible-to-make-nginx-listen-to-different-ports
https://stackoverflow.com/questions/36262449
复制相似问题