프로그램설치

nginx + ssl + tomcat (5)

예쁜꽃이피었으면 2020. 2. 14. 09:29

AWS(ubuntu) / nginx / apache tomcat / sts (mybatis) / docker / mysql / vue.js

 

[SSL적용하고.. 완성하기]

# sudo su
실시간 로그 보면서 완성시키자
# tail -f /usr/local/apache-tomcat-8.5.50/logs/catalina.out
# tail -f /var/log/nginx/error.log
# tail -f /var/log/nginx/access.log

 

# sudo vim /etc/nginx/sites-available/default

server {
        listen 80;
        server_name www.도메인 도메인;

        return 301 https://$server_name$request_uri;
        root /var/www/html;  
        index index.php index.html index.htm;

        error_page 405 = $uri;
        location ~ /\.ht {
                deny  all;
        }
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
}
server{

       listen443;
        server_name 도메인; 

 

       location / {
              access_log off;
              expires max;
        }

 

        location /api {
               proxy_pass http://127.0.0.1:8080;  
               proxy_set_header X-Real-IP $remote_addr;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
               proxy_set_header Host $http_host;
        }

        ssl on;
        ssl_certificate /etc/letsencrypt/live/도메인/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/도메인/privkey.pem;
}

 

 

# sudo vi /usr/local/apache-tomcat-8.5.50/conf/server.xml

 

...

<Connector port="8080" protocol="HTML/1.1"   

   connectionTimeout="2000"

   redirectPort="8443" scheme="https"/>

 

....

 

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" SSLEngine="on"/>

 

....

 

마지막으로 Vue에서 sts컨트롤러 호출할 때 

http://localhot:8080/ 여기 지우고

/abc부터 호출

 

꼬박 4일 걸림.. 끝

반응형