使用apache只处理使用IP地址的http和https通信

我已经在ubuntu 16.04上设置了apache2.4.1,以便在端口80和443上同时处理httphttps通信。我可以浏览到这两个站点,没有任何问题。

服务器可以通过公共IP和私有IP进行访问 – 远程api服务通过vpn将stream量发送到我的服务器。

这是我的apachectl -S结果

*:80 APPSERVER.example.com (/etc/apache2/sites-enabled/000-default.conf:1) *:443 is a NameVirtualHost default server APPSERVER.example.com (/etc/apache2/sites-enabled/000-default-ssl.conf:2) port 443 namevhost APPSERVER.example.com (/etc/apache2/sites-enabled/000-default-ssl.conf:2) port 443 namevhost APPSERVER.example.com (/etc/apache2/sites- enabled/default-ssl.conf:2) ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2/error.log" Mutex rewrite-map: using_defaults Mutex ssl-stapling-refresh: using_defaults Mutex ssl-stapling: using_defaults Mutex ssl-cache: using_defaults Mutex default: dir="/var/lock/apache2" mechanism=fcntl Mutex mpm-accept: using_defaults Mutex watchdog-callback: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="www-data" id=33 Group: name="www-data" id=33 

这是我的000-default.conf

 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www> Options Indexes FollowSymLinks MultiViews AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

这里是000-default-ssl.conf

  <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www> Options Indexes FollowSymLinks MultiViews AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/certificate_bundle.cer SSLCertificateKeyFile /etc/apache2/ssl/appserver.key SSLCertificateChainFile /etc/apache2/ssl/intermediateCA.cer <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> </IfModule> 

问题是,当远程api服务试图使用https发送xml post请求时,我在我的日志文件中得到臭名昭着的“\ x16 \ x03 \ x01”400 0“ – ”“ – ”“。

任何人都可以指出我可能会做错我的configuration导致此错误。

我看不到任何会导致此问题的configuration。 问题是客户端正在向您的HTTPS虚拟主机发送HTTP。

这可能是由于您的configuration或应用程序中的“ http://example.com:443/ ”redirect引起的,但不是其他的。 我没有看到任何会导致这种情况在您的configuration。 从目前为止给我们展示的信息来看,远程服务更有可能出现问题。

编辑:更正,如下面@ dave_thompson_085指出的,我有这个错误的方式。 客户端正在向HTTP虚拟主机发送HTTPS。