[sudo] apt-get install stunnelcd path/to/django/project
mkdir stunnel
cd stunnelCreate the key:
openssl genrsa 1024 > stunnel.key
openssl req -new -x509 -nodes -sha1 -days 365 -key stunnel.key > stunnel.cert
cat stunnel.key stunnel.cert > stunnel.pemCreate the dev_https file with:
pid=
cert = stunnel/stunnel.pem
sslVersion = SSLv3
foreground = yes
output = stunnel.log
[https]
accept=8443
connect=8001
TIMEOUTclose=1이렇게 해봤는데 사실 잘 안되었다. 모바일에서 위치정보를 받아오려고 데스크탑에서 https 서버를 띄우고 같은 네트워크에 연결된 와이파이를 통해서 데스크탑에서 띄운 장고서버에 접속하려고 했는데 계속 에러가 남
error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
이 에러가 계속나서 찾아보니
sslVersion = all
로 바꾸란다.
그래서 바꿨더니
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
이렇게 나오길래
client = no
여기서 변수들을 설명하자면
accept=8443
은 8443 포트로 데스크탑 서버에 접근하는 것을 말하는 것이고
connect=8001
그 접근을 8001포트로 연결한다는 것이다.
Now go to project root and create a runserver file:
stunnel4 stunnel/dev_https &
python manage.py runserver&Sets the permission:
chmod a+x runserverThe SSL works in:
https://localhost:8443