nginx监听443,apache监听8443。
nginx配置
server {
listen 443;
# server_name *.ht920.com ht920.com;
server_name www.ht920.com;
ssl on;
ssl_certificate cert/1523974750873.pem;
ssl_certificate_key cert/1523974750873.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
index index.html index.htm index.php;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://localhost:8443;
}
access_log logs/ht920.com_access.log;
}
现象是:
我访问 https://www.ht920.com/e/admin/ 正常访问,
访问 https://www.ht920.com/e/admin 不行,会跳转到 https://www.ht920.com:8443/e/admin/
我在服务器访问了curl -k https://localhost:8443/e/admin
得到结果是:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://localhost:8443/e/admin/">here</a>.</p>
</body></html>
问题是,我要如何配置,才能正确301跳转?
可以在server_name下面这行这个试试