Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 443端口无故连接到主机名_Php_Ssl_Nginx_Centos - Fatal编程技术网

Php 443端口无故连接到主机名

Php 443端口无故连接到主机名,php,ssl,nginx,centos,Php,Ssl,Nginx,Centos,我在https://hostname.example 但是所有的请求都要通过https://hostname.example:443(该网站的前一位开发人员告诉我们,它应该直接转到主机名,而不使用ssl端口) 这似乎对一个网站产生了不良影响——有些功能不起作用 比如说, 信息: CentOS 6.8 nginx 1.10.2 ssl证书存在并已配置(不是由我提供) 问题是: 为什么所有请求都开始通过ssl端口,而它们以前没有这样做 如何解决这个问题并使所有请求都只通过主机名 请告诉我问题中

我在
https://hostname.example
但是所有的请求都要通过
https://hostname.example:443
(该网站的前一位开发人员告诉我们,它应该直接转到主机名,而不使用ssl端口)

这似乎对一个网站产生了不良影响——有些功能不起作用

比如说,

信息:

CentOS 6.8

nginx 1.10.2

ssl证书存在并已配置(不是由我提供)

问题是:

  • 为什么所有请求都开始通过ssl端口,而它们以前没有这样做
  • 如何解决这个问题并使所有请求都只通过主机名
请告诉我问题中还包括什么来澄清问题

UPD


UPD_2。好的,谢谢大家的评论。我会去其他地方寻找问题的根源。

443是https的端口,所以它存在是有原因的。请求不能直接转到主机名,它必须是主机名和端口的组合。浏览器几乎总是根据协议选择端口,而您却看不到它

您在屏幕截图中看到的是完全正常的,请在任何其他https站点上尝试,它看起来都一样


您可能在其他地方有bug,或者您没有向我们展示问题中的问题。

您的nginx配置是什么样子的?您是否搜索了整个代码库中的
443
或某些重定向,以查找或包含proto?在其中,某些内容正在强制重定向到该端口,因此请按照Lawrence所说的那样,对
443
@LawrenceRone执行完整搜索我添加的配置文件。在代码库中有一个js代码,乍一看基本上是选择端口80,否则选择443(但同样,这与编写代码的前一位开发人员相矛盾,因此我可能误解了此代码的实际功能…)似乎您对http和https的理解是正确的。无法想象为什么开发者会觉得奇怪。。。
default.conf 
#
# The default server
#

server {
    listen       80 default_server;
#    listen       [::]:80 default_server;
server_name  www.hostname.example;

return 301 https://$server_name$request_uri;

#root         /path/to/root;
#index index.php index.html;

# Load configuration files for the default server block.
#include /etc/nginx/default.d/*.conf;

#location ~ ^/purge(/.*) {
#    allow     127.0.0.1;
#    allow     192.168.118.10;
#    deny     all;
#    fastcgi_cache_purge portalName $request_method$http_if_modified_since$http_if_none_match$host$1;
#}

#location / {
#}

#error_page 404 /404.html;
#    location = /40x.html {
#}

#error_page 500 502 503 504 /50x.html;
#    location = /50x.html {
#}

#location ~ \.php$ {
#    fastcgi_cache  portalName;
#   fastcgi_cache_valid 200 301 302 304 60m;
#   fastcgi_cache_key "$request_method$http_if_modified_since$http_if_none_match$host$request_uri";
#   fastcgi_pass_header "X-Accel-Expires";

#        set $no_cache 0;
#        fastcgi_cache  pubcache;
#        fastcgi_cache_valid 200 301 302 304 5m;
#        fastcgi_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
#        fastcgi_cache_use_stale updating error timeout invalid_header http_500;

#        fastcgi_pass_header Set-Cookie;
#        fastcgi_pass_header Cookie;
#        fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

#        fastcgi_cache_bypass $no_cache;
#        fastcgi_no_cache $no_cache;
#        proxy_cache_purge  PURGE from 127.0.0.1,192.168.118.10;

#    fastcgi_pass 127.0.0.1:9000;
##   fastcgi_pass unix:/var/run/php-fpm.sock;
#    fastcgi_index index.php;
#    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
#    fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
#    fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;
#    fastcgi_param HTTP_X_REAL_IP $remote_addr;
#    include        fastcgi_params;
#}
}








ssl.conf
#
# HTTPS server configuration
#

server {
    listen       443 ssl http2 default_server;
#    listen       [::]:443 ssl;
server_name  www.hostname.example;
root         /path/to/root;
index       index.php index.html;
#
#    ssl_certificate hostname.example.crt;
#    ssl_certificate_key  hostname.example.key;
ssl_certificate hostname_example.crt;
ssl_certificate_key  hostname_example.key;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout  10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
#
#    # Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#
location / {
    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }

    location ~ \.php$ {
        fastcgi_cache  portalName;
    fastcgi_cache_valid 200 301 302 304 60m;
    fastcgi_cache_key "$request_method$http_if_modified_since$http_if_none_match$host$request_uri";
    fastcgi_pass_header "X-Accel-Expires";

#        set $no_cache 0;
#        fastcgi_cache  pubcache;
#        fastcgi_cache_valid 200 301 302 304 5m;
#        fastcgi_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
#        fastcgi_cache_use_stale updating error timeout invalid_header http_500;

#        fastcgi_pass_header Set-Cookie;
#        fastcgi_pass_header Cookie;
#        fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

#        fastcgi_cache_bypass $no_cache;
#        fastcgi_no_cache $no_cache;
#        proxy_cache_purge  PURGE from 127.0.0.1,192.168.118.10;

        fastcgi_pass 127.0.0.1:9000;
    #   fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
        fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;
        fastcgi_param HTTP_X_REAL_IP $remote_addr;
        include        fastcgi_params;
    }
}