Welcome! Log In Create A New Profile

Advanced

wrong format when displaying nodejs page

Posted by Homer-S 
wrong format when displaying nodejs page
September 24, 2016 11:52AM
Hello,

my English is not that good so I tried first in German section of this great forum. But no respons so far.

I installed ghost blogging on my Raspberry Pi in subdirectory /var/www/ghost

If I enter "localhost:2368/ghost" in my browser page is displayed liek it should be.
So far so good, but ...

If I try to access it via "external-serveradress/ghost" it shows up the page very basic without any formations.
Same issue if I go with "Internal-IP-Adress-in-my-network/ghost"
even if I add the port :2368 it i not improving.

It seems that you guys are my last hope, thanks in advance for your support.

This is my entry in my config file:

############################
## Abschnitt ghost intern ##
############################
location /ghost {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:2368/ghost;
proxy_redirect off;

}
Re: wrong format when displaying nodejs page
September 24, 2016 05:59PM
I missed the two screenshots.
Attachments:
open | download - 2016-09-19 20_41_31-192.168.100.67 - Remotedesktopverbindung.jpg (39 KB)
open | download - 2016-09-19 20_41_59-192.168.100.67 - Remotedesktopverbindung.jpg (55.1 KB)
Re: wrong format when displaying nodejs page
September 30, 2016 02:09PM
Please, is there nobody out there who knows a hint or at least maybe some different place to raise the question?

Thanks, you see me really desperate.
Re: wrong format when displaying nodejs page
September 30, 2016 03:43PM
On the external page you don't see the port number being used (2368), so the browser defaults to try to use port 80 from which nothing is coming from and why you don't get all page elements.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: wrong format when displaying nodejs page
September 30, 2016 05:50PM
OK, I think I see the point, but how do I fix it. Because I thought with

proxy_pass http://127.0.0.1:2368/ghost;

I am forwarding the port 80 to 2368.

Maybe I should show more of my config file:
Sorry and many thanks

####################
## port 80 intern ##
####################

server {
listen 80;
server_name 192.168.100.67;
root /var/www;
index index.php index.htm index.html index.js;

############################
## Abschnitt ghost intern ##
############################
location /blog {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:2368/ghost;
proxy_redirect off;

}
}
Re: wrong format when displaying nodejs page
September 30, 2016 07:10PM
Homer-S Wrote:
-------------------------------------------------------
> OK, I think I see the point, but how do I fix it. Because I thought
> with
>
> proxy_pass http://127.0.0.1:2368/ghost;
>
> I am forwarding the port 80 to 2368.

Internally a request on port 2368 is passed to 80, locally you might get a reply back from port 80 without you seeing it, externally port 80 is not open so a reply from 80 does not reach the client.

What you need to do is tell your proxypass application that its port is 2368 and not 80 (in order to get the application to reply back on the proxy port).

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: wrong format when displaying nodejs page
October 01, 2016 04:45AM
To illustrate what I mean look at this tomcat example:

<!-- This connector is for normal HTTP connections -->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="30000" disableUploadTimeout="true" proxyPort="443"
proxyName="app.mydom.nl"

It is listening on 8080 but proceeded by a nginx proxy on 443 (in on 443, proxypass to 8080), anything tomcat replies to is send to the client with references to port 443 and not 8080 (as 8080 is not open externally).

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: wrong format when displaying nodejs page
October 01, 2016 11:23AM
Thanks for your patience and help.
Just to help me if I understood it right.

the request from 192.168.100.67/blog is forwarded to 127.0.0.1:2368/blog
but if ghost is sending something it is trying to send on port 2368. And this port is basically closed?

Is this solvable with an entry in my nginx config file?

I tried to find some solution but without success.
Re: wrong format when displaying nodejs page
October 01, 2016 11:46AM
No you need to tell ghost what it's external port is (used by nginx).

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: wrong format when displaying nodejs page
October 01, 2016 11:47AM
One more thing which may help to find the solution.

I just found out ghost ist logging in real time in terminal window.

First I tried to access from a Laptop by 192.168.100.67
Secondly I did an access with 127.0.0.1:2368/blog on the server itself

This was the output:

192.168.100.67 - - [01/Oct/2016:15:38:53 +0000] "GET /blog/ghost/img/ghosticon.jpg HTTP/1.1" 200 2499 "-" "Mozilla/5.0"
192.168.100.30 - - [01/Oct/2016:15:38:54 +0000] "GET /blog/ HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0"

127.0.0.1 - - [01/Oct/2016:15:40:01 +0000] "GET /blog/ HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; ARM Mac OS X) AppleWebKit/538.15 (KHTML, like Gecko) Safari/538.15 Version/6.0 Raspbian/8.0 (1:3.8.2.0-0rpi27rpi1g) Epiphany/3.8.2"

127.0.0.1 - - [01/Oct/2016:15:40:01 +0000] "GET /blog/ HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; ARM Mac OS X) AppleWebKit/538.15 (KHTML, like Gecko) Safari/538.15 Version/6.0 Raspbian/8.0 (1:3.8.2.0-0rpi27rpi1g) Epiphany/3.8.2"

127.0.0.1 - - [01/Oct/2016:15:40:02 +0000] "GET /blog/assets/css/screen.css?v=7791bd7438 HTTP/1.1" 200 - "http://127.0.0.1:2368/blog/" "Mozilla/5.0 (Macintosh; ARM Mac OS X) AppleWebKit/538.15 (KHTML, like Gecko) Safari/538.15 Version/6.0 Raspbian/8.0 (1:3.8.2.0-0rpi27rpi1g) Epiphany/3.8.2"

127.0.0.1 - - [01/Oct/2016:15:40:02 +0000] "GET /blog/assets/js/jquery.fitvids.js?v=7791bd7438 HTTP/1.1" 200 - "http://127.0.0.1:2368/blog/" "Mozilla/5.0 (Macintosh; ARM Mac OS X) AppleWebKit/538.15 (KHTML, like Gecko) Safari/538.15 Version/6.0 Raspbian/8.0 (1:3.8.2.0-0rpi27rpi1g) Epiphany/3.8.2"

127.0.0.1 - - [01/Oct/2016:15:40:02 +0000] "GET /blog/assets/js/index.js?v=7791bd7438 HTTP/1.1" 200 - "http://127.0.0.1:2368/blog/" "Mozilla/5.0 (Macintosh; ARM Mac OS X) AppleWebKit/538.15 (KHTML, like Gecko) Safari/538.15 Version/6.0 Raspbian/8.0 (1:3.8.2.0-0rpi27rpi1g) Epiphany/3.8.2"
Re: wrong format when displaying nodejs page
October 15, 2016 03:08PM
I found my mistake:

this brought the solution

location ^~ /blog {
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 191
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready