# HTTP configuration
#
server {
    listen 8080 default_server;
    listen [::]:8080 default_server;

    root /var/www/html/public;

    # Set allowed "index" files
    index index.html index.htm index.php;

    server_name _;

    charset utf-8;

    # Set max upload to 2048M
    client_max_body_size 2048M;

    location /index.php {
        try_files /not_exists @octane;
    }

    location / {
        try_files $uri $uri/ @octane;
    }

    location @octane {
        set $suffix "";

        if ($uri = /index.php) {
            set $suffix ?$query_string;
        }

        proxy_http_version 1.1;
        proxy_set_header Host $http_host;
        proxy_set_header Scheme $scheme;
        proxy_set_header SERVER_PORT $server_port;
        proxy_set_header REMOTE_ADDR $remote_addr;
        proxy_set_header X-Forwarded-For $http_fly_client_ip;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

        proxy_pass http://127.0.0.1:8000$suffix;
    }

    # additional config
    include /etc/nginx/server-opts.d/*.conf;
}
