Hi!
am going through the pain barrier now
only half understand what i am doing
get bad gateway 502
so if i put in http it is changing nicely to https and good certificate via certbot
my rocketchat server is running i think
[root@localhost nginx]# systemctl status rocketchat.service
● rocketchat.service - The Rocket.Chat server
Loaded: loaded (/usr/lib/systemd/system/rocketchat.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2018-09-29 19:51:47 UTC; 40min ago
Main PID: 45640 (node)
CGroup: /system.slice/rocketchat.service
└─45640 /usr/local/bin/node /opt/Rocket.Chat/main.js
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | Rocket.Chat Version: 0.70.0 |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | NodeJS Version: 8.9.3 - x64 |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | Platform: linux |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | Process Port: 80 |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | Site URL: https://domain |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | ReplicaSet OpLog: Disabled |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | Commit Hash: 40b50f3164 |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | Commit Branch: HEAD |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ | |
Sep 29 19:52:03 localhost rocketchat[45640]: ➔ ±-----------------------------------------------------+
site_url ok??? and port???
vi /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf; **###nothing there tho anyway**
server {
if ($host = www.xyz.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = xyz.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name .domain www.domain;
return 404; # managed by Certbot
}
Upstreams
upstream backend {
server 127.0.0.1:3000; ###no idea what this backend is!!!
}
server {
server_name xyz.com;
error_log /var/log/nginx/rocketchat.access.log;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf; **###nothing there anyway!**
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/xyz.com/fullchain.pem; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/xyz.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xyz.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE
##### the above commented out as otherwise says duplicate… don’t know where it is ###loading other
ssl_dhparam /etc/ssl/certs/dhparam.pem; ##added by dmhz
location / {
proxy_pass http://backend/; **###is this right????**
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}
} ###think this is http close
[root@localhost nginx]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
anyway thanks for reading this far!!!
any advice embraced
ta
richard