我已经安装了我的证书并配置了我的nginx来监听端口443.但仍然无法连接到端口443.缺少一些东西??
在我的ssl.conf中
#
server {
listen 443 ssl;
server_name www.newbullets.co.nz newbullets.co.nz;
ssl on;
ssl_certificate /etc/ssl/certs/ssl-bundle.crt;
ssl_certificate_key /etc/ssl/server.key;
ssl_session_timeout 5m;
#location / {
# root html;
# index index.html index.htm;
#}
}
和default.config
server {
listen 80;
server_name newbullets.co.nz www.newbullets.co.nz;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
auth_basic "input you user name and password";
auth_basic_user_file /var/www/www.newbullets.co.nz/.htpasswd;
root /usr/share/nginx/html/nb/;
index index.html index.htm index.php;
try_files $uri $uri/ @handler;
}
更新
我在我的ssl.conf中添加了以下内容,现在在Firefox中它显示了网页但SSL绿色栏已经消失,Chrome仍然会下载该网页。任何想法?
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/nb$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;
}
答案 0 :(得分:6)
listen 443 default_server ssl;
答案 1 :(得分:1)
我的解决方案:
简明:在CentOS 7
中,使用防火墙工具firewalld
或iptables
来进行 MAKESURE https 443
端口打开。
详细信息:
如@Greg Lund-Chaix
所述,您应确保打开443端口。
即使netstat
显示监听443端口,我的位置也是:
[root@crifan.com nginx]# netstat -nlp | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2193/nginx: master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2193/nginx: master
Aliyun ECS
的{{1}}已将规则添加到Security Group
但实际上,这里的allow in for 443 port
输出看不到iptables -L
:
https
并最终使用iptables -L --line-numbers
...
Chain IN_public_allow (1 references)
num target prot opt source destination
1 ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ctstate NEW
2 ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data ctstate NEW
3 ACCEPT tcp -- anywhere anywhere tcp dpt:ftp ctstate NEW
4 ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ctstate NEW
5 ACCEPT tcp -- anywhere anywhere tcp dpt:http ctstate NEW
6 ACCEPT tcp -- anywhere anywhere tcp dpt:ddi-tcp-1 ctstate NEW
7 ACCEPT tcp -- anywhere anywhere tcp dpts:39000:safetynetp ctstate NEW
添加firewalld
和https
端口:
443
或使用firewall-cmd --zone=public --add-service=https --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --reload
插入http(num = 5)之前:
iptables
然后别忘了保存更改:
iptables -I IN_public_allow 5 -p tcp --dport 443 -j ACCEPT