Troubleshooting Forever and port 4567
-
@planner I have the same problem. When my home page is visited, nodebb send a [ "ws://..." 502 bad gateway ] on chrome console, and widgets are not loaded.
But after user click on any link, the error not occurring any more
I'm using nginx proxy bypass.
How you resolved this?Thanks
-
Because I have tons of images on the site that I could not use when accessing the site from a subfolder, I decided to run the site from a subdomain. So I abandoned the subfolder route.
-
@planner What is your config.json and ngix.conf?
Ps: I have used mydomain in this post instead of my real domain
my config.json:
{ "base_url": "http://www.mydomain.com", "port": "4567", "use_port": true, "secret": "-", "bind_address": "127.0.0.1", "database": "mongo", "mongo": { "host": "127.0.0.1", "port": "27017", "username": "-", "password": "-", "database": "-" }, "bcrypt_rounds": 12, "upload_path": "/public/uploads", "relative_path": "" }
And my nginx.conf
user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile off; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # Uncomment it if you installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { listen 80; server_name www.mydomain.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # # Specific for comet or long running HTTP requests, don't buffer up the # response from origin servers but send them directly to the client. # #proxy_buffering off; # supposedly prevents 502 bad gateway error; # ultimately not necessary in my case proxy_buffers 8 32k; proxy_buffer_size 64k; tcp_nodelay on; } } }
When user access the website, chrome send this error:
WebSocket connection to 'ws://www.mydomain.com/socket.io/1/websocket/zDbVq799NSBdGgWrBH0o' failed: Unexpected response code: 502
-
If you set ***relative_path to /forum and proxy_pass to http://127.0.0.1:4567/forum, it should work, but likely with the problem I had uploading images.
And if that is the real secret in your config.json, you might want to remove it.
-
@planner I'm using a single domain on my ec2 Instance...
So, i really need to set a relative path?That error started after to cloudflare dns pointed to my Elastic IP. Using only IP address, this error not occurred.
I need to set other config on nginx, like a site available or something else?