misskey-dev / misskey

🌎 An interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
9.84k stars 1.33k forks source link

502 Bad Requset #3222

Closed Never2333 closed 5 years ago

Never2333 commented 5 years ago

Hello, I am new to here. When I finish my installation, and open the website, it said error 502. I tried to reboot the VPN and reload the mirror, but the issues is still going on.

syuilo commented 5 years ago

Thank you for your reporting. Are you using Nginx? :)

Never2333 commented 5 years ago

Yes

syuilo commented 5 years ago

ok thanks. Please show me your configuration of Misskey and nginx.

Never2333 commented 5 years ago

Okay, but could you please wait for a while, I am having dinner, sorry.

Never2333 commented 5 years ago
name: example-instance-name # Name of your instance
description: example-description # Description of your instance

maintainer:
  name: example-maitainer-name # Your name
  url: http://example.com/ # Your contact (http or mailto)

# Final accessible URL seen by a user.
url: https://misskey.never666.com/

# port: 3000    # A port that your Misskey server should listen.

mongodb:
  host: localhost
  port: 27017
  db: misskey
  user: misskey
  pass: 6631330Zhang

redis:
  host: localhost
  port: 6379
  pass: example-pass
Never2333 commented 5 years ago
ap $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}

server {
    listen       80;
    listen       443 ssl http2;
    server_name  misskey.never666.com misskey.never666.com;
    client_max_body_size 100m;
    client_body_buffer_size 2048k;
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }

    ssl_certificate    /etc/letsencrypt/live/misskey.never666.com/fullchain.pem;
    ssl_certificate_key    /etc/letsencrypt/live/misskey.never666.com/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    error_page 497  https://$host$request_uri;

location / {
    proxy_set_header Host $host;
    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 https;
    proxy_set_header Proxy "";
    proxy_pass_header Server;

    proxy_pass http://127.0.0.1:3000;
    proxy_buffering off;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;

    tcp_nodelay on;
  }
}
Never2333 commented 5 years ago

I use CentOS 7.4 X64

syuilo commented 5 years ago

Thank you. I think you need to uncomment the setting of the port.

# port: 3000    # A port that your Misskey server should listen.

to

port: 3000    # A port that your Misskey server should listen.
Never2333 commented 5 years ago

Oh, I am going to try it. Thank you very much!

syuilo commented 5 years ago

Good luck!

Never2333 commented 5 years ago

Sorry, I tried a few times, but it still displayed 502. The log said this:

[root@]# systemctl status misskey
● misskey.service - Misskey daemon
   Loaded: loaded (/etc/systemd/system/misskey.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Tue 2018-11-13 22:22:42 CST; 4s ago
  Process: 5301 ExecStart=/usr/bin/npm start (code=exited, status=1/FAILURE)
 Main PID: 5301 (code=exited, status=1/FAILURE)

Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: misskey.service: main process exited, code=exited, status=1/FAILURE
Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: Unit misskey.service entered failed state.
Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: misskey.service failed.
Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: misskey.service holdoff time over, scheduling restart.
Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: start request repeated too quickly for misskey.service
Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: Failed to start Misskey daemon.
Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: Unit misskey.service entered failed state.
Nov 13 22:22:42 iZj6cb7o9hu1q9z6pz4jswZ systemd[1]: misskey.service failed.
Never2333 commented 5 years ago

This is misskey.service

[Unit]
Description=Misskey daemon

[Service]
Type=simple
User=root
ExecStart=/usr/bin/npm start
WorkingDirectory=/root/misskey
TimeoutSec=60
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=misskey
Restart=always
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
syuilo commented 5 years ago

Can you launch Misskey without Nginx?

Never2333 commented 5 years ago

emmm How to do it?

syuilo commented 5 years ago

Please write config as:

port: 443

https:
  key: /etc/letsencrypt/live/misskey.never666.com/privkey.pem
  cert: /etc/letsencrypt/live/misskey.never666.com/fullchain.pem
Never2333 commented 5 years ago

The misskey config?

syuilo commented 5 years ago

yes

Never2333 commented 5 years ago
name: example-instance-name # Name of your instance
description: example-description # Description of your instance

maintainer:
  name: Never # Your name
  url: http://never666.com/ # Your contact (http or mailto)

# Final accessible URL seen by a user.
url: https://misskey.never666.com/

  port: 3000    # A port that your Misskey server should listen.

port: 443

https:
  key: /etc/letsencrypt/live/misskey.never666.com/privkey.pem
  cert: /etc/letsencrypt/live/misskey.never666.com/fullchain.pem

mongodb:
  host: localhost
  port: 27017
  db: misskey
  user: misskey
  pass: example-pass

redis:
  host: localhost
  port: 6379
  pass: examle-pass
Never2333 commented 5 years ago

Is this right?

syuilo commented 5 years ago

Seems port setting duplicated. remove this line:

port: 3000 # A port that your Misskey server should listen.
Never2333 commented 5 years ago

Okay, and then?

syuilo commented 5 years ago
  1. Stop Nginx
  2. In your misskey directory, run npm start command
AyaMorisawa commented 5 years ago

( By the way, have you checked journalctl -at misskey ? )

Never2333 commented 5 years ago

@AyaMorisawa Not yet

Never2333 commented 5 years ago

@syuilo It works!

Never2333 commented 5 years ago
[root@iZj6cb7o9hu1q9z6pz4jswZ misskey]# npm start

> misskey@10.49.1 start /root/misskey
> node ./built

[22:53:41 INFO] Welcome to Misskey!
[22:53:41 INFO] <<< Misskey v10.49.1 >>>
[22:53:41 INFO] [Deps] Node.js v10.13.0
[22:53:41 INFO] [Machine] Hostname: iZj6cb7o9hu1q9z6pz4jswZ
[22:53:41 INFO] [Machine] Platform: linux
[22:53:41 INFO] [Machine] Architecture: x64
[22:53:41 INFO] [Machine] CPU: 2 core
[22:53:41 INFO] [Machine] MEM: 3.7GB (available: 3.2GB)
[22:53:41 INFO] [Env] NODE_ENV is not set
[22:53:41 WARN] [Env] The environment is not in production mode
[22:53:41 WARN] [Env] Do not use for production purpose
[22:53:41 INFO] [Env] You have root privileges
[22:53:41 INFO] [Config] Loaded
[22:53:41 INFO] [MongoDB] Connecting to mongodb://misskey:****@localhost:27017/misskey
[22:53:41 INFO] Misskey initialized
[22:53:41 INFO] Starting workers...
[22:53:44 INFO] All workers started
[22:53:44 INFO] Now listening on port 443 on https://
  <-- GET /
  --> GET / 200 18ms 2.07kb
  <-- GET /assets/locales/en-US.json
  --> GET /assets/locales/en-US.json 200 8ms 16.06kb
  <-- GET /favicon.ico
  --> GET /favicon.ico 200 5ms 5.15kb
  <-- GET /assets/desktop.2.0.11745.js
  <-- POST /api/meta
  --> POST /api/meta 200 450ms 560b
  --> GET /assets/desktop.2.0.11745.js 200 5,331ms 591.02kb
  <-- GET /assets/ai.png
  <-- POST /api/meta
  <-- POST /api/notes
  <-- POST /api/hashtags/trend
  <-- POST /api/aggregation/hashtags
  <-- POST /api/notes/local-timeline
  <-- POST /api/stats
  --> POST /api/notes 200 37ms 2b
  --> POST /api/notes/local-timeline 200 36ms 2b
  --> POST /api/meta 200 51ms 407b
  --> POST /api/hashtags/trend 200 38ms 2b
  --> POST /api/aggregation/hashtags 200 37ms 2b
  --> POST /api/stats 200 38ms 102b
  --> GET /assets/ai.png 200 741ms 220.19kb
syuilo commented 5 years ago

Well done :) Thank you @AyaMorisawa !

Never2333 commented 5 years ago

By the way, How can I let it keep on running when I disconnect from ssh? Use screen?

syuilo commented 5 years ago
  1. npm i -g forever
  2. forever start ./built instead of npm start
Never2333 commented 5 years ago

Okay, well done

Never2333 commented 5 years ago

Thank you very much. And sorry about disturbing

syuilo commented 5 years ago

np!

Never2333 commented 5 years ago

@syuilo @AyaMorisawa Please accept my sincere appreciation for your help. Sorry about my poor English grammar xD.

Never2333 commented 5 years ago

Excuse me again, how to set up an administrator account?

mei23 commented 5 years ago

On console, type node cli/mark-admin.js @USER to become admin

Never2333 commented 5 years ago

@mei23 That works, thank you.

Never2333 commented 5 years ago

@syuilo Are there any ways to add translations and apply right now on the local server?

AyaMorisawa commented 5 years ago

(@Never2333 When you have a question not related to the issue, please create a new issue. :pray: )