Setelah menggenerate CSR, langkah berikutnya adalah menggabungkan server certificate dan intermediate certificate. Dua-duanya diperoleh setelah proser approval dari CSR. Berikut langkahnya.
Menggabungkan Certificate
Untuk lebih memudahkan, lokasi ssl certificate biasanya dikumpulkan pada direktori /etc/ssl
# cd /etc/ssl # mkdir example.com # cd example.com # vim example.com.rapidssl.crt [--- COPY PASTE CERTIFICATE ---] # vim example.com.intermediate.crt [--- COPY PASTE CERTIFICATE ---] ## gabungkan certificate # cat example.com.rapidssl.crt > example.com.pem # cat example.com.intermediate.crt >> example.com.pem
Buat virtual host baru untuk menghandle koneksi HTTPS (port 443).
# cd /etc/nginx/site-available
# cp example.com example.com-ssl
# vim example.com-ssl
server {
# ubah dari 80 menjadi 443
# 192.168.1.10 hanyalah contoh
listen 192.168.1.10:443;
server_name example.com;
# lokasi letak file SSL certificate
ssl on;
ssl_certificate /etc/ssl/example.com/example.com.pem;
ssl_certificate_key /etc/ssl/example.com/example.com.key;
# lempar semua request ke Apache kecuali ada konfigurasi directive location lain
location / {
proxy_pass http://127.0.0.1;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# lokasi static content
# URL yang diawali http://example.com/static akan langsung dihandle nginx dan tidak dilempar ke apache
#
# Contoh:
# http://example.com/static/js/jquery.js
# http://example.com/static/css/style.css
location /static {
expires max; # masa expires maximum agar browser menyimpan cache lebih lama
# dokumen webroot dari URL /static
root /var/www/vhosts/example.com;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
## buat symlink
# cd /etc/nginx/site-enabled
# ln -s ../site-available/example.com-ssl
## restart nginx
# service nginx restart
Coba buka alamat website dengan prefix https contoh https://example.com/.
0 comments:
Post a Comment