Hi!
I just set up discourse and then followed this guide.
My subdomain for the forum is forum.example.com.
However, when I go to example.com, I just get redirected to forum.example.com
Here is my Namecheap DNS setting:
This is my outer nginx config:
wordpress.conf (my main site):
server {
listen 80;
#listen 443 default ssl;
server_name snapecraft.net;
root /var/www/html;
#ssl_certificate /etc/nginx/ssl/mydomain.crt;
#ssl_certificate_key /etc/nginx/ssl/mydomain.key;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log error;
index index.php index.phtml index.html;
location / {
try_files $uri $uri/ /index.php?$args;
if (-f /var/ErrorPages/maintenance.html) {
return 400;
}
# add one directive for each http status code
error_page 400 /ErrorPages/maintenance.html;
error_page 404 /ErrorPages/404.html;
error_page 503 /ErrorPages/503.html;
}
# redirect the virtual ErrorPages path the real path
location /ErrorPages/ {
alias /var/ErrorPages/;
internal;
}
# location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_intercept_errors on;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include /etc/nginx/fastcgi_params;
#
# }
location ~ [^/]\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
discourse.conf (Config for the forum):
server {
listen 80; listen [::]:80;
server_name forum.snapecraft.net; # <-- change this
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2; listen [::]:443 ssl http2;
server_name forum.snapecraft.net; # <-- change this
ssl on;
ssl_certificate /var/discourse/shared/standalone/ssl/forum.snapecraft.net.cer;
ssl_certificate_key /var/discourse/shared/standalone/ssl/forum.snapecraft.net.key;
ssl_dhparam /var/discourse/shared/standalone/ssl/dhparams.pem;
ssl_session_tickets off;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
http2_idle_timeout 5m; # up from 3m default
location / {
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
}
}
Thanks a bunch in advance! Any help is highly appreciated!