• converting Nginx config to HTTPD

    From mike r@21:1/5 to All on Wed Nov 17 07:07:29 2021
    Hello, Im trying to port a vhost config from nginx to apache,

    Im running a VueJS app and need to proxy a backend,

    it works in Nginx, but cant figure out Apache syntax,

    can someone help translating this ngninx config to apache?

    specifically the /api backend rewrite, I'm gettting Invalid Host Header when running this in Apache


    server {
    listen 80;
    server_name www.netportal.corp.com netportal.corp.com;
    return 301 https://$host$request_uri;
    }

    server {
    listen 443 ssl;
    server_name www.netportal.corp.com netportal.corp.com;
    error_page 404 =301 https://www.corp.com;

    ssl_certificate /etc/ssl/certs/star.crt;
    ssl_certificate_key /etc/ssl/certs/star.key;

    location /api {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    rewrite ^/api/?(.*) /$1 break;
    proxy_redirect off;
    proxy_pass http://localhost:5301;
    }

    location / {
    proxy_pass http://0.0.0.0:5300/;
    }
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)