RoonZ
By:
RoonZ

Why is my website working?

January 18, 2017 253 views
Ghost Nginx Ubuntu

Hello, i'm looking at my ngix config and can't figure out why my site is working. Nowhere in the config can i find the path to my ghostblog /var/www/ghost.
In /etc/nginx/sites-enabled/ is only one file (default) and the content looks like this:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name 178.62.230.180; # Replace with your domain

    root /usr/share/nginx/html;
    index index.html index.htm;

    client_max_body_size 10G;

    location / {
        proxy_pass http://localhost:2368;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    } 
}

So the config points to /usr/share/nginx/html and not /var/www/ghost.

Can someone please tell me why my site stil works?? where else is the path to /var/www/ghost configured beside the config file at sites-enabled??

Thanks in advance!

1 Answer
jtittle January 18, 2017
Accepted Answer

@RoonZ

You're site still works because NGINX is configured to function as a proxy, which can be identified by the following:

    location / {
        proxy_pass http://localhost:2368;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    } 

This means that all requests to / on your domain (i.e. any request) will be proxied to port 2368. If that's the port that your Ghost installation is listening on, then essentially any request to / is proxied to your Ghost installation.

The /usr/share/nginx/html directory doesn't matter with the above configuration (for the purpose of this explanation) since your Ghost installation isn't pulling from there when the proxy request is handled on port 2368.

Have another answer? Share your knowledge.