Nginx Logo | https://dwglogo.com
Nginx Logo | https://dwglogo.com

Berikut contoh konfigurasi server block Nginx:

server {
  listen 80;
  listen [::]:80;

  server_name say.iqbal.es;
  root /var/www/say.iqbal;
}

Jika menggunakan SSL, berikut contoh konfigurasinya:

server {
  listen 80;
  listen [::]:80;

  server_name say.iqbal.es;
  return 301 https://$server_name$request_uri;
}
server {
        listen 443;
        server_name say.iqbal.es;
        root /var/www/say.iqbal;

        ssl on;
        ssl_certificate     /etc/letsencrypt/live/say.iqbal.es/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/say.iqbal.es/privkey.pem;
        ssl_session_timeout 15m;
        ssl_protocols SSLv3 TLSv1;
        ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
        ssl_prefer_server_ciphers on;
}

Generate SSL Let’s Encrypt di CentOS 7

Dan ini untuk konfigurasi Nginx sebagai Reverse Proxy:

server {
  listen 80;
  listen [::]:80;

  server_name k.iqbal.es;

  location / {
      proxy_pass http://k.iqbal.es:6969;
  }
}

Semoga bermanfaat :3

Sumber : https://www.nginx.com