<p>I discovered the issue. The issue was a conflict in the craft. I had the wrong URL in Settings &gt; Sites: [This site has its own base URL] should be clicked and the correct URL should be provided. When the site is live I will come back and post more information to demonstrate the result.</p>

CC BY-SA 4.0
2021-06-21T16:50:04.363Z
2021-06-21T16:50:04.363Z
David A McInnis
<p>I have a Craft CMS blog site that is hosted on an apache web server. I would like to proxy that site to my Flask-based web app at <a href="http://example.com/blog/" rel="nofollow noreferrer">http://example.com/blog/</a> where <a href="http://example.com" rel="nofollow noreferrer">http://example.com</a> is the main URL for the app. <a href="http://example.com/blog/" rel="nofollow noreferrer">http://example.com/blog/</a> does not have any application routes so it is a safe URL to use.</p>
<p>Here is the relevant part of my NGINX config.</p>
<pre><code>    location ^~ /blog/ {
        include proxy_params;
        proxy_pass http://cms.example.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location / {
        auth_basic &quot;Stealth Mode - Coming Soonish&quot;;
        auth_basic_user_file /etc/nginx/.htpasswd;

        include proxy_params;
        proxy_pass http://127.0.0.1:3000;
    }
</code></pre>
<p>My problem is that I get the following Template Not Found error.</p>
<pre><code>    Template not found: blog
</code></pre>
<p>Any ideas how to fix this? The fact that I am getting a Craft error indicates to me that the issue is a craft config issue, but I am not ruling out some sort of nginx error config error.</p>

CC BY-SA 4.0
2021-06-19T19:04:13.397Z
Update. I have pretty much eliminated Nginx as the issue here since I was able to proxy a static site through. So I think I am looking at a Craftcms issue here.
David A McInnis
CC BY-SA 4.0
2021-06-19T19:07:59.250Z
In your case, when you hit http://cms.example.com directly (outside of nginx) what happens? That's the blog "home page" more or less?
RitterKnight
CC BY-SA 4.0
2021-06-20T01:29:13.207Z
When I hit cms.example.com directly the site renders properly but as cms.example.com and not cms.example.com/blog. The difference is that I am trying to reverse proxy it under example.com/blog
David A McInnis
<craft3><nginx>
Use NGINX to proxy a Craft CMS site hosted on apache into an existing site
# Use NGINX to proxy a Craft CMS site hosted on apache into an existing site

(Asked by: username_0 on 2021-06-19)

I have a Craft CMS blog site that is hosted on an apache web server. I would like to proxy that site to my Flask-based web app at http://example.com/blog/ where http://example.com is the main URL for the app. http://example.com/blog/ does not have any application routes so it is a safe URL to use.
Here is the relevant part of my NGINX config.
    location ^~ /blog/ {
        include proxy_params;
        proxy_pass http://cms.example.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location / {
        auth_basic "Stealth Mode - Coming Soonish";
        auth_basic_user_file /etc/nginx/.htpasswd;

        include proxy_params;
        proxy_pass http://127.0.0.1:3000;
    }

My problem is that I get the following Template Not Found error.
    Template not found: blog

Any ideas how to fix this? The fact that I am getting a Craft error indicates to me that the issue is a craft config issue, but I am not ruling out some sort of nginx error config error.

**Tags:** craft3, nginx

> **Comments:**
> **username_0**: Update. I have pretty much eliminated Nginx as the issue here since I was able to proxy a static site through. So I think I am looking at a Craftcms issue here.  
> **username_1**: In your case, when you hit http://cms.example.com directly (outside of nginx) what happens? That's the blog "home page" more or less?  
> **username_0**: When I hit cms.example.com directly the site renders properly but as cms.example.com and not cms.example.com/blog. The difference is that I am trying to reverse proxy it under example.com/blog  

---

## 1 answers

### Answer by username_0 on 2021-06-21. Score: 1 | Accepted answer

I discovered the issue. The issue was a conflict in the craft. I had the wrong URL in Settings > Sites: [This site has its own base URL] should be clicked and the correct URL should be provided. When the site is live I will come back and post more information to demonstrate the result.


---

