Nginx反向代理到带有SSL的tomcat的问题旨在将tomcat端口8080转发到80

时间:2019-07-03 10:22:38

标签: tomcat https reverse-proxy nginx-reverse-proxy nginx-config

我是nginx和revere代理的初学者。我有运行nginx的ubuntu机器,让我们在xxx.com上加密。我在http://example.com:8080http://ip:8080上运行的tomcat tomcat应用

现在,我希望我的应用程序在按/及其全部通过ssl(让我们加密)后才能运行。我尝试了几天,但无法配置和运行。

server {
        listen 80;
        return 301 https://$host$request_uri;
}
server {
        listen 443;
        server_name linuxtechlab.com;
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl on;

        ssl_session_cache builtin:1000 shared:SSL:10m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        ssl_prefer_server_ciphers on;
        access_log /var/log/nginx/access.log;
        location / {
        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_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://localhost:8080;
        proxy_read_timeout 90;
        proxy_redirect http://localhost:8080 https://example.com;
}
}

感谢您的支持专家。

0 个答案:

没有答案