Linux Server Note – Nginx反向代理

OS系統

Debian / Ubuntu

STEP 1

#apt update && apt install nginx

STEP 2

#service nginx start

STEP 3

修改/etc/nginx/nginx.conf,添加以下Code

server {
        listen 80;
        server_name [ServerIP or Domain];
        location / {
            proxy_pass http://[ServerIP or Domain]:[Port];
        }
}
server {
        listen 443 ssl;
        server_name [Domain,e.g. mingwant.com];
        ssl_certificate [path of .pem];
        ssl_certificate_key [path of .key];
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        location / {
            root html;
            index index.html index.htm;
            proxy_pass https://mingwant.com;
        }
}

參考資料:

https://naiyous.com/2224.html