Cannot login to admin panel - Ubuntu Linux 16.04.2


#1

This is a fresh install of Ghost on Ubuntu Linux 16.04.2:

Ghost-CLI version: 1.9.9
Ghost version: 2.13.1 (at /var/www/myblog) 

When I load the admin page and save the first userid, I get the following error message. Looking at the MySQL database table, I do see that the userid has been created.

When a look at the output from journalctl -u ghost_rchampagne-ca -n 50, I see the following error message:

-- Logs begin at Sun 2019-01-27 14:11:06 EST, end at Tue 2019-01-29 13:31:04 EST. --
Jan 29 13:30:06 ubuntu-server node[24828]: INFO [2019-01-29 18:30:06] "GET //ghost/assets/img/favicon.ico" 200 4ms
Jan 29 13:30:06 ubuntu-server node[24828]: INFO [2019-01-29 18:30:06] "GET //ghost/api/v2/admin/authentication/setup/" 200 21ms
Jan 29 13:30:06 ubuntu-server node[24828]: INFO [2019-01-29 18:30:06] "GET //ghost/api/v2/admin/authentication/setup/" 200 15ms
Jan 29 13:30:06 ubuntu-server node[24828]: INFO [2019-01-29 18:30:06] "GET //ghost/assets/img/install-welcome-ff3912d18bf8949df89c83b1c3b8bb66.png" 200 4ms
Jan 29 13:30:08 ubuntu-server node[24828]: INFO [2019-01-29 18:30:08] "GET //ghost/assets/img/user-image-0d67f7ca80917835524605cf4d106aef.png" 200 2ms
Jan 29 13:30:25 ubuntu-server node[24828]: INFO [2019-01-29 18:30:25] "GET //ghost/" 200 12ms
Jan 29 13:30:37 ubuntu-server node[24828]: INFO [2019-01-29 18:30:37] "GET //robots.txt" 200 8ms
Jan 29 13:30:40 ubuntu-server node[24828]: INFO [2019-01-29 18:30:40] "GET //" 200 528ms
Jan 29 13:30:40 ubuntu-server node[24828]: INFO [2019-01-29 18:30:40] "GET //assets/built/screen.css?v=fa7672ef2d" 200 10ms
Jan 29 13:30:40 ubuntu-server node[24828]: INFO [2019-01-29 18:30:40] "GET //assets/built/jquery.fitvids.js?v=fa7672ef2d" 200 6ms
Jan 29 13:30:40 ubuntu-server node[24828]: INFO [2019-01-29 18:30:40] "GET //assets/built/infinitescroll.js?v=fa7672ef2d" 200 3ms
Jan 29 13:30:41 ubuntu-server node[24828]: INFO [2019-01-29 18:30:41] "POST //ghost/api/v2/admin/authentication/setup/" 201 745ms
Jan 29 13:30:41 ubuntu-server node[24828]: /var/www/myblog/versions/2.13.1/core/server/services/auth/session/middleware.js:62
Jan 29 13:30:41 ubuntu-server node[24828]:         req.session.user_id = req.user.id;
Jan 29 13:30:41 ubuntu-server node[24828]:                             ^
Jan 29 13:30:41 ubuntu-server node[24828]: TypeError: Cannot set property 'user_id' of undefined
Jan 29 13:30:41 ubuntu-server node[24828]:     at /var/www/myblog/versions/2.13.1/core/server/services/auth/session/middleware.js:62:29
Jan 29 13:30:41 ubuntu-server node[24828]:     at session (/var/www/myblog/versions/2.13.1/node_modules/express-session/index.js:195:71)
Jan 29 13:30:41 ubuntu-server node[24828]:     at getSession (/var/www/myblog/versions/2.13.1/core/server/services/auth/session/middleware.js:48:12)
Jan 29 13:30:41 ubuntu-server node[24828]:     at Object.createSession (/var/www/myblog/versions/2.13.1/core/server/services/auth/session/middleware.js:52:
Jan 29 13:30:41 ubuntu-server node[24828]:     at /var/www/myblog/versions/2.13.1/core/server/api/v2/session.js:33:34
Jan 29 13:30:41 ubuntu-server node[24828]:     at /var/www/myblog/versions/2.13.1/node_modules/express-brute/index.js:60:9
Jan 29 13:30:41 ubuntu-server node[24828]:     at _combinedTickCallback (internal/process/next_tick.js:73:7)
Jan 29 13:30:41 ubuntu-server node[24828]:     at process._tickDomainCallback (internal/process/next_tick.js:128:9)
Jan 29 13:30:41 ubuntu-server systemd[1]: ghost_rchampagne-ca.service: Service hold-off time over, scheduling restart.

Whenever I try to login with the same credentials, I get the same error messages in the browser and the log journal.


#2

From your logs it looks like your receiving requests with doubled slashes (e.g. GET //ghost/api/…). This will mess with Ghosts ability to check the Path of the session cookie and result in req.session being undefined.

What webserver are you using? You should be able to configure that to correctly forward paths!


#3

Hello Fabien,

The web server is Apache version 2.4.37.

I have another Ghost blogging site as well hosted on a Google Cloud Compute Engine. This older site is running flawlessly:

Ghost-CLI version: 1.9.9
Ghost version: 2.1.2 (at /var/www/ghost2) 

The Apache directives for this new site are:

ProxyPreserveHost On
ProxyPass http://127.0.0.1:2777/
ProxyPassReverse  http://127.0.0.1:2777/

The configuration file is:

{
  "url": "http://rchampagne.ca/",
  "server": {
    "port": 2777,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
   etc ...

I’m wondering if I should rolback to a previous version of Ghost.


#4

Hey Roger!

I’m not super familiar with Apache, but is it possible that the directives you’re using are doubling up the / as seen in your logs?

I would probably try ProxyPass and ProxyPassReverse with http://127.0.01:2777 without the trailing /.

You can try rolling back to a previous version, but I’m fairly certain it’s because the urls that are hitting ghost have double slashes in them (relevant issue: https://github.com/TryGhost/Ghost/issues/9982)


#5

You’re right ! Dropped trailing slash in Apache directives :

ProxyPreserveHost On
ProxyPass http://127.0.0.1:2777
ProxyPassReverse  http://127.0.0.1:2777

Sincere regards,
Roger.


closed #6

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