标签:lin add 申请 www ali 点击 blank 管理 event
基础准备: 一台服务器,一个主域名或多级域名,本次申请的免费
本次环境使用 centos6.5 + nginx1.8 + jdk1.8 + tomcat8
如果需要收费的请参考:
full_chain.pem --> 1_blog.zousiliang.com_bundle.crt
private.key --> 2_blog.zousiliang.com.key
下载 jdk1.8 和 tomcat8 配置流程一样
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream tomcats{ server localhost:8080; } server{ listen 80; server_name blog.zousiliang.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name blog.zousiliang.com; ssl on; ssl_certificate 1_blog.zousiliang.com_bundle.crt; ssl_certificate_key 2_blog.zousiliang.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; location / { proxy_pass http://tomcats$request_uri; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto https; client_max_body_size 10m; } } }
tomcat service.xml 文件中配置如下
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" proxyPort="443" URIEncoding="UTF-8" /> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="x-forwarded-for" remoteIpProxiesHeader="x-forwarded-by" protocolHeader="x-forwarded-proto" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host>
访问 http://blog.zousiliang.com 或者 https://blog.zousiliang.com 出现如下效果表示配置成功
转自:https://hacpai.com/article/1525254970376
标签:lin add 申请 www ali 点击 blank 管理 event
原文地址:https://www.cnblogs.com/alter888/p/9450984.html