草庐IT

Nginx转发https

全部标签

php - cURL 登录到 HTTPS 站点

我一直在尝试使用cURL和PHP将登录凭据发布到https站点,但没有成功。对于不安全的站点,一切正常,但我无法使用https获取它。我知道我发布的标题详细信息是正确的(尽管我为了这个例子模拟了它们)。请帮忙。 最佳答案 导出证书。将其上传到您的脚本可以看到的位置。然后添加:curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,true);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);curl_setopt($ch,CURLOPT_CAINFO,getcwd()."/pa

php - 如何确定重定向到 https 的位置

我正在开发一个网站,当通过http访问时,该网站会自动重定向到https。我们正在尝试确定发生这种情况的位置。到目前为止,我们已经查看了以下地方:.htaccess在httpd.conf中的apache中在我们编写的测试页面的php文件中(site.com/test.php)我想在apache中可能有一些其他的conf文件会发生这种重定向的事情..我还应该看哪里? 最佳答案 我以前也遇到过同样的问题。您查看过虚拟主机文件了吗?通常存放在/etc/httpd/conf/vhosts/我敢打赌,您有一个通用的重定向规则,例如www.go

相当于 nginx 的 "virtual()"函数的 php

有没有适用于nginx的php函数,其工作方式与适用于apache的“virtual()”相同? 最佳答案 不,没有。与Apache不同,nginx不使用模块与PHP通信。虽然这是一件好事,但它也有诸如此类的负面影响。我可以推荐使用include或file_get_contents吗? 关于相当于nginx的"virtual()"函数的php,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/quest

php - 从 nginx 重定向中删除端口

我遇到一个问题,网站上的某些重定向包含代理传递端口,导致它们无用。我的配置如下:物理服务器1:server{server_nameexample.comwww.example.com;location/{proxy_passhttp://1.1.1.1:50493;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerHost"example.com";}}物理服务器2:server{listen50493;server_nameexample.comwww.example.com;set_real_ip_from1.1.1.1;r

PHP cURL 在 HTTPS 上返回 FALSE

我正在尝试制作一个机器人:https://coinroll.it/api来自网站:CoinrollAPI是一个通过HTTPS工作的无状态接口(interface)。请求是使用POST变量(application/x-www-form-urlencoded)发出的,而响应是用JSON(application/json)编码的。访问API需要HTTPS连接。我有以下代码:$ch=curl_init();$data=array('user'=>'xxx','password'=>'yyy');curl_setopt($ch,CURLOPT_URL,'https://coinroll.it')

php - 将 nginx 错误重定向到 php

我的目标是将nginx中的任何错误(即404、405等...)重定向到我位于index.php的php脚本.`server{root/usr/share/nginx/TradeLog/www/;indexindex.phpindex.htmlindex.htmdefault.htmldefault.htm;#Makesiteaccessiblefromhttp://localhost/server_namelocalhost;server_name_in_redirectoff;fastcgi_intercept_errorson;error_page403404/index.php/

php - 如何为官方 nginx Docker 镜像使用自定义 Nginx 配置?

我有下一个docker-compose文件:nginx:build:.ports:-"80:80"-"443:443"links:-fpmfpm:image:php:fpmports:-"9000:9000"Dockerfile命令列表是:FROMnginxADD./index.php/usr/share/nginx/html/#ChangeNginxconfighere...Nginx服务器工作正常,我可以在http://localhost/index.html上看到默认的html页面,但不执行PHP脚本。所以当我得到http://localhost/index.php-浏览器下载P

php - 如何用GET参数转发?

如何使用GET参数进行转发?我在同一个Controller中有两个Action。我在第一个Action中做了一些魔术,如果一切顺利,我希望它转发到另一个Action,但使用在第一个Action中创建的GET参数。我现在拥有的是:return$this->forward('AppBundle:default:tracked',array(),array('tracking_code'=>$tracking_code,'company'=>$tp_company_name)));由于拼命努力让它工作,所以里面的数组是空的。Documentation告诉第二个数组用于查询参数,但实际上什么也

php - nginx: [emerg] "location"指令在/etc/nginx/conf.d/default.conf:1 中不允许

我刚开始在AWSAMI实例上使用Nginx,但遇到了一些启动问题。我已点击此链接安装php-fpm和nginxhttps://gist.github.com/sumardi/5559803除了,我不需要mysql,所以我没有运行这个命令sudoyum-yinstallmysql-servermysql我的/etc/nginx/conf.d/default.conf看起来像这样:location/{root/var/www/html;indexindex.phpindex.htmlindex.htm;}location~\.php${fastcgi_passunix:/var/run/p

php - Nginx 为静态文件代理不正确的 fastcgi_script_name

server{listenloc.app:80;root/app/frontend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_args$args;}location~^/admin{proxy_passhttp://127.0.0.1:81;}location~*\.php${#phpconf}}server{listen127.0.0.1:81;root/app/backend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_arg