Links not using the port specified in the URL

Hi all,

I set up ghost this weekend. After jumping through some hoops I have a working local installation using a dedicated ghost user (called ghostuser rather than ghost as the ghost user is ‘special’), nginx and mysql but I have one problem remaining.

In my ghost config I have:

  "url": "",
  "server": {
    "port": 2370,
    "host": ""

I have nginx operating as a proxy but the links generated are always to port 2370 not to port 84. I also have in my nginx config:

upstream ghost_backend {

server {
   listen 84;
   server_name _;

   location / {
            proxy_pass http://ghost_backend;
            proxy_set_header Host $host:84;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

I’ve tried various things but I’m still not sure if the problem is on the nginx or ghost side.

As I understand it including the port in the URL should tell ghost to use that port in all generated links but it does not seem to be working.
Any advice on how I can diagnose this?

I should mention I am currently using this within my intranet only and don’t have a domain name or SSL at present.

1 Like

Can you confirm that the URL is correctly reflected in Ghost? On the server, run

curl | sed 's/,/\n/g' | grep url
1 Like

Never mind the sed that returns an error pretty printed below:

>curl | jq .
  "errors": [
      "message": "Resource not found",
      "context": null,
      "type": "NotFoundError",
      "details": null,
      "property": null,
      "help": null,
      "code": null,
      "id": "d47a4a50-e04a-11ee-854b-dda1175f6a24",
      "ghostErrorCode": null
1 Like

Gaah, typos! It’s good to know you have jq installed :stuck_out_tongue:

Can you try with

and with jq you can do .site.url

1 Like

You’ll want to try on port 2370 ( the Ghost port) and use the fixed path

curl | jq .site.url
curl | jq .site.url

Both give:”

I have a regular apache on port 80 so I’m proxying to port 84. I don’t think its the problem but I can try temporarily switching over.

That’s the reason Ghost is giving the “wrong” URL - it’s configured to! :smiley:

Can you confirm that the Ghost URL is correct - ghost config get url? If it is, can you restart Ghost to make sure the changes were picked up?


> ghost config get url

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.

and I have restarted ghost several times.

I gave up and reinstalled ghost to another directory and now it is behaving correctly.

My few test images got lost but that’s okay.

I had to move my installation from /home/ghostuser to /home/ghostuser/ghost. ghost thinks it owns everything in the directory its installed to which is definitely not the case if you install it in the home folder of a user.