Hi, I’m getting started with running Discourse on a Digital Ocean Ubunto 14.04 LEMP droplet, alongside WordPress. Everything was running fine, using the SSO WordPress plugin for Discourse. Discourse is in a subdomain.
I subsequently installed a wildcard SSL. WordPress is running fine, but when I try to connect to Discourse I get a 502 Bad gateway error. I have tried editing the /etc/nginx/sites-enabled/default file and /etc/nginx/conf.d/discourse.conf with no success. This isn’t really my area and I can see I’m going to make things worse if it keep tinkering…
This is the content of /etc/nginx/conf.d/discourse.conf
server {
listen 80; listen [::]:80;
server_name forum.mydomain.com; # <-- change this
return 301 https://$host$request_uri;
}
server {
listen 443 ssl spdy;
listen [::]:443 ssl spdy;
server_name forum.mydomain.com; # <-- change this
ssl on;
ssl_certificate /usr/local/etc/ssl/pusslcert.crt;
ssl_certificate_key /usr/local/etc/ssl/pusslcertprivate.key;
ssl_dhparam /usr/local/etc/ssl/dhparam.pem;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM$
# enable SPDY header compression
spdy_headers_comp 6;
spdy_keepalive_timeout 300; # up from 180 secs default
location / {
proxy_pass https://unix:/var/discourse/shared/standalone/nginx.https.sock:;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
This is the content of cd /etc/nginx/sites-enabled/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name mydomain.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# HTTPS server
#
server {
listen 443 default ssl;
listen [::]:443 ssl;
server_name mydomain.com;
ssl_certificate /usr/local/etc/ssl/pusslcert.crt;
ssl_certificate_key /usr/local/etc/ssl/pusslcertprivate.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES25$
ssl_prefer_server_ciphers on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
These are from the /var/log/nginx/error.log
2016/04/29 21:54:21 [crit] 3680#0: *1299 connect() to unix:/var/discourse/shared/standalone/nginx.https.sock failed (2: No such file or directory) while connecting to upstream, client: 58.175.118.49, server: forum.mydomain.com, request: "GET / HTTP/1.1", upstream: "https://unix:/var/discourse/shared/standalone/nginx.https.sock:/", host: "forum.mydomain.com"
2016/04/29 21:54:22 [crit] 3680#0: *1299 connect() to unix:/var/discourse/shared/standalone/nginx.https.sock failed (2: No such file or directory) while connecting to upstream, client: 58.175.118.49, server: forum.mydomain.com, request: "GET /favicon.ico HTTP/1.1", upstream: "https://unix:/var/discourse/shared/standalone/nginx.https.sock:/favicon.ico", host: "forum.mydomain.com", referrer: "https://forum.mydomain.com/"
I’m afraid I’m not sure what this is telling me or what needs to be done to fix it. Obviously mydomain.com has been changed and is correct in the actual files.
In /var/discourse/containers/app.yml the following ports are exposed:
- "2222:22" # If you don't need to use ./launcher ssh app, you can remove this too
Can anyone advise me on what I need to edit? If its a bigger job I’m happy to pay someone with the expertise to fix this. Perhaps PM me if that’s the case.