我正在尝试设置我自己的安全代理,以供我编写的Django Python脚本使用,该脚本依赖于安全代理来正确返回https请求。这是因为脚本是从美国主机服务器上运行的,我希望响应来自英国。
为了实现这一点并学习一些新的东西,我正在尝试配置一个运行在我的Raspberry Pi上的Apache服务器。(我预计不会有大量的流量!)
我已经成功地创建了SSL证书,并拥有正确的文件.pem、.csr (和.csr)。
我相信我已经将它们复制到了正确的位置: /etc/ssl/private和/etc/ssl/certs。我认为我现在遇到的唯一问题是apache配置。
目前,我正在尝试配置启用站点的/default-ssl.conf文件,如下所示:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SSLCertificateFile /etc/ssl/certs/aa5758835031e4a3.crt
SSLCertificateKeyFile /etc/ssl/private/<domainname>.key我对服务器的设置非常陌生,我花了大量的时间在网上搜索和尝试许多不同的建议方法。我确信这是我忽略的非常简单的事情,但经验不足;我不能凭直觉解决这个问题。
感谢您的帮助和指点...
更新:
嘿,谢谢你的回复。
对http的响应: is
* Rebuilt URL to: http://*.*.*/
* Trying 184.168.221.1...
* TCP_NODELAY set
* Connected to *.*.* port 80 (#0)
> GET / HTTP/1.1
> Host : *.*.*
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 302 Found
< Connection: close
< Pragma: no-cache
< cache-control: no-cache
< Location: /VZaKp/
<
* Curl_http_done: called premature == 0
* Closing connection 0 https是:
* Rebuilt URL to: https://*.*.*/
* Trying 50.63.202.18...
* TCP_NODELAY set
* connect to 50.63.202.18 port 443 failed: Connection timed out
* Failed to connect to *.*.* port 443: Connection timed out
* Closing connection 0
curl: (7) Failed to connect to *.*.* port 443: Connection timed out更新23.04.2018:
谢谢。我相信我已经解决了听力问题,但现在遇到了一个新的问题!
尝试重新启动apache2服务时,出现以下错误:
Apr 23 12:31:30 matthew-raspberry systemd[1]: Starting The Apache HTTP Server...
Apr 23 12:31:31 matthew-raspberry apachectl[8341]: Action 'start' failed.
Apr 23 12:31:31 matthew-raspberry apachectl[8341]: The Apache error log may have more information.
Apr 23 12:31:31 matthew-raspberry systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 23 12:31:31 matthew-raspberry systemd[1]: Failed to start The Apache HTTP Server.
Apr 23 12:31:31 matthew-raspberry systemd[1]: apache2.service: Unit entered failed state.
Apr 23 12:31:31 matthew-raspberry systemd[1]: apache2.service: Failed with result 'exit-code'.我怀疑这可能与我的fqdn设置和/或证书有关。在将ServerName本地主机添加为全局名称时,我得到了这个错误。我添加这个是因为前面的错误消息是关于确定我的fqdn名称,这建议添加ServerName作为全局变量?
发布于 2018-04-22 21:40:14
端口443即使在基本TCP级别也是不可到达的。确保在Apache配置中包含以下内容:
Listen 443 https配置更改后重新加载httpd。检查firewall-cmd --list-all-zones或iptables -S,查看是否允许连接到端口443。
https://stackoverflow.com/questions/49924088
复制相似问题