0

I have a domain tmhos.church and a simple index.html located at cosmoscomputers.com:3597/ref/tmhos. (they're on the same digital ocean droplet server & dns)

I'm trying to hide tmhos.church so that it appears to be its own website, while actually being at above /ref/tmhos.

I have found this article How to preserve request url with nginx proxy_pass (close i think, but not exactly my problem) and have an nginx config that looks like below... but when i go to tmhos.church, it goes to the top of cosmoscomputers.com (but does keep the tmhos.church domain in the address bar (good)). If I then manually add /ref/tmhos to the end, it goes to the page i want to be the root. I confess i don't know what ALL the lines are doing (eg the 'rewrite' regex), but the proxy_pass isn't doing exactly what i want.

server {
    listen 80;
    listen [::]:80;

    server_name tmhos.church www.tmhos.church;

    location / {

        rewrite            ^(.*)$   "://$http_host$uri$is_args$args";
        rewrite            ^(.*)$   "http$uri$is_args$args" break;
        proxy_set_header   Host     $host;

        proxy_pass http://138.197.133.227:3597/ref/tmhos;

    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}
Fred
  • 129
  • 2
  • 11

1 Answers1

0

Can you please try:

server {
    listen 80;
    listen [::]:80;

    server_name tmhos.church www.tmhos.church;

    location / {
        proxy_set_header Host $host;
        proxy_pass http://cosmoscomputers.com:3597/ref/tmhos/;
    }

    location ~ /\.ht {
        deny all;
    }
}
Raul
  • 579
  • 1
  • 4
  • 13
  • Amazing what the slash on the END does... it works! – Fred Oct 15 '19 at 18:50
  • yes. and also you had a lot of other stuff in the config that did not make sense to me. does it work as expected? – Raul Oct 15 '19 at 19:37
  • Perfectly, in all testing so far... THX! – Fred Oct 15 '19 at 23:57
  • Please be sure to accept the answer as the correct one if everything works, thanks! – Raul Oct 16 '19 at 00:27
  • Ya, i was trying to... don't see how to do that... I even tried upvoting, but i don't have enough credits yet. Tried the "Answer Your Question" button, but it leaves a field for ME to answer (not accept yours)... do you know how? – Fred Oct 16 '19 at 18:09
  • There should be a big check mark right under the answer "down vote" button. Clicking on that should do it :) – Raul Oct 16 '19 at 19:50