Skip to content

Instantly share code, notes, and snippets.

@udhos
Created November 22, 2021 18:22
Show Gist options
  • Select an option

  • Save udhos/393e1a19ff14788f2e75e855276e7997 to your computer and use it in GitHub Desktop.

Select an option

Save udhos/393e1a19ff14788f2e75e855276e7997 to your computer and use it in GitHub Desktop.
nginx reverse proxy: http -> https
nginx -v
nginx version: nginx/1.20.0

more /etc/nginx/nginx.conf
# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log debug;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       8080;
        listen       [::]:8080;

        location / {
                proxy_pass              https://backend_hostname_here;
        }
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment