Removing https://localhost:2368 from RSS Feed and Latest Post


#1

INTRODUCTION

Hello folks,
I am glad to be part of the ghost community.
Unfortunately I am stuck with the configuration of my ghost installation and I hope that you can give me some advices to fix my problem.

  • What is the problem?
    “Latest Post”-, “RSS FEED”- and “HOME”-Link (Footer) are redirecting to https://localhost:2368 - i want them to redirect to my site.

  • What’s your URL?
    https://www.dataku.de

  • What version of Ghost are you using?
    Ghost-CLI version: 1.7.1
    Ghost Version (at /var/lib/ghost): 1.22.2

  • What configuration?
    I am using a full supported docker environment with nginx, docker-gen, letsencrypt, ghost and maria db.

My .env file for the ghost environment is as followed:

# .env file to set up your ghost site

#
# Network name
# 
# Your container app must use a network conencted to your webproxy 
# https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
#
NETWORK=webproxy

#
# Database Container configuration
# We recommend MySQL or MariaDB - please update docker-compose file if needed.
#
CONTAINER_DB_NAME=db

# Path to store your database
DB_PATH=/path/to/your/local/database/folder

# Root password for your database
MYSQL_ROOT_PASSWORD=root_password

# Database name, user and password for your ghost
MYSQL_DATABASE=database_name
MYSQL_USER=user_name
MYSQL_PASSWORD=user_password

#
# Ghost Container configuration
#
CONTAINER_GHOST_NAME=ghost

# Path to store your ghost files
GHOST_CORE=/path/to/your/ghost/core/files
GHOST_CONTENT=/path/to/your/ghost/content

# Table prefix
GHOST_TABLE_PREFIX=ghost_

#help  Your domain (or domains)
DOMAINS=dataku.de,www.dataku.de

# Your email for Let's Encrypt register
LETSENCRYPT_EMAIL=your_email@domain.com

   # You complete site url
SITE_URL=https://www.dataku.de
   
   # Environment Status (production, development)
STATUS=production

My docker compose file is as followed:

version: '3'

services:
   db:
     container_name: ${CONTAINER_DB_NAME}
     image: mariadb:latest
     restart: unless-stopped
     volumes:
        - ${DB_PATH}:/var/lib/mysql
     environment:
       MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
       MYSQL_DATABASE: ${MYSQL_DATABASE}
       MYSQL_USER: ${MYSQL_USER}
       MYSQL_PASSWORD: ${MYSQL_PASSWORD}

   ghost:
     depends_on:
       - db
     container_name: ${CONTAINER_GHOST_NAME}
     image: ghost:latest
     restart: unless-stopped
     volumes:
       - ${GHOST_CORE}:/var/www/html
       - ${GHOST_CONTENT}:/var/www/html/ghost/content
     environment:
       GHOST_DB_HOST: ${CONTAINER_DB_NAME}:3306
       GHOST_DB_NAME: ${MYSQL_DATABASE}
       GHOST_DB_USER: ${MYSQL_USER}
       GHOST_DB_PASSWORD: ${MYSQL_PASSWORD}
       GHOST_TABLE_PREFIX: ${GHOST_TABLE_PREFIX}
       VIRTUAL_HOST: ${DOMAINS}
       LETSENCRYPT_HOST: ${DOMAINS}
       LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} 
       GHOST_URL: ${SITE_URL}
       NODE_ENV: ${STATUS}

networks:
    default:
       external:
         name: ${NETWORK}
  • What browser?
    In any browser (chrome, firefox, safari)

  • What steps could someone else take to reproduce the issue you’re having?
    Please follow the instructions to setup your nginx-proxy with letsencrypt environment (you will find in these repositories a full instruction for setup):


After finishing the nginx-proxy setup for docker, please follow these instructions for setup your blog software with ghost and maria db:


#2

/Resolved

I just had to change in the config.production.json the localhost url to my url.
sudo docker exec -it |CONTAINER ID| bash
apt-get update
apt-get install vim
vim config.production.json

I only changed to url:https://www.dataku.de while letting port:2368 and host:0.0.0.0.


#3

I would think that this is kind of resolved. (edit in a docker container isn’t a solution … )

Personal I have docker 1-alpine image what is currently 1.22.4 running on localhost and NGINX Proxy with SSL listening on all interfaces. I have set GHOST_URL in my docker compose.

Version: '2'
services:
  web:
    restart: always
    image: ghost:1-alpine
    ports:
      - "127.0.0.1:2368:2368"
    volumes:
      - /srv/ghost/content:/var/lib/ghost/content
    environment:
      GHOST_URL: https://jalogisch.de

My NGINX contains

  location / {

    proxy_pass http://127.0.0.1:2368;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    # 2 lines below are to avoid Ghost https redirect bug
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;

  }

So all was working fine before the migration to the new host. Here I needed the “quickfix” above - but using the environment variable would be my favorit solution.

Did someone else see this?


#4

You are right.
Doing configuration in a Docker container is bad practice.

The environment variable for your url in the docker-compose.yml have to be „url=„

version: '2'
services:
  web:
    restart: always
    image: ghost:1-alpine
    ports:
      - "127.0.0.1:2368:2368"
    volumes:
      - /srv/ghost/content:/var/lib/ghost/content
    environment:
      - url=https://jalogisch.de

Check out my .env-sample and docker-compose.yml in my Repository:

It is working and everything is configurable through .env


#5

thx that is indeed the fix for me - i would wish that this scenario is a little deeper dokumented.


#6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.