HUGO

Reverse Proxy

Hi, I want to use Hugo via a reverse proxy… As far as the config:

<VirtualHost *:80>

    ServerName <mydomain>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RewriteEngine on

    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

</VirtualHost>

<VirtualHost *:443>

    ServerName <mydomain>

    SSLEngine On

    SSLCertificateFile    /etc/letsencrypt/archive/<mydomain>/cert.pem

    SSLCertificateKeyFile /etc/letsencrypt/archive/<mydomain>/privkey.pem

    SSLCertificateChainFile /etc/letsencrypt/archive/<mydomain>/fullchain.pem

    ProxyPass / http://127.0.0.1:5000/

    ProxyPassReverse / http://127.0.0.1:5000/

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Runs so far, but always comes:

If you’re committed to doing the sysadmin stuff for a webserver like apache (as opposed to using netlify, vercel etc), then why use hugo server at all? Just push your hugo-generated public folder content to a vhost folder. Fewer moving parts, for sure?

You’re listening on 5000, so, did you specify that port when running hugo server?

By the way there are plenty of posts in here about “reverse proxy”.

If you’re committed to doing the sysadmin stuff for a webserver like apache (as opposed to using netlify, vercel etc), then why use hugo server at all? Just push your hugo-generated public folder content to a vhost folder. Fewer moving parts, for sure?

Is correct! LUL! I didn’t even know :rofl:!

You’re listening on 5000, so, did you specify that port when running hugo server?

Yes