[英]How can I run a PHP project deployed in Heroku locally on Windows?
[英]How can I make a 'GET' request in the same server that php project deployed?
情況:
我使用nginx和fastcgi在機器A中將php項目部署為Web服務器,其配置文件如下:
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
都沒有用。 我不知道是什么問題。
您需要將nginx配置為通過localhost或127.0.0.1進行偵聽才能正常工作。
有關完整說明,請參見http://nginx.org/en/docs/http/ngx_http_core_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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.