Question

How i run ghost in subdomain ?

  • Posted January 2, 2014

Hi,

this my first time setup ghost blog so i try to put it in subdomain but i don’t know how, i use nginx and ubuntu 12.0.4 LTS …

i need it to work in subdomain so i can put another thing in main…

also i have another issue when i type my domain without www it’s not work !! you can check http://csbukhari.com/ http://www.csbukhari.com/

help me please

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@wjhsie: <pre>proxy_set_header X-Real-IP $remote_addr; <br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; <br>proxy_set_header X-Forwarded-Proto $scheme; <br>proxy_set_header Host $http_host; <br>proxy_set_header X-NginX-Proxy true; <br>[…] <br>proxy_set_header Upgrade $http_upgrade; <br>proxy_set_header Connection “upgrade”; </pre>sets the headers nginx should add while proxying the contents to Ghost/nodejs<pre>proxy_read_timeout 5m; <br>proxy_connect_timeout 5m; </pre>sets a couple of connection parameters.<pre>proxy_pass http://127.0.0.1:1337; </pre>sets the server nginx should proxy to (in this case it’s a nodejs app that is listening on port 1337 on the loopback interface). <br> <br>As for the proxy_redirect line, see <a href=“http://wiki.nginx.org/HttpProxyModule#proxy_redirect”>http://wiki.nginx.org/HttpProxyModule#proxy_redirect</a>. <br> <br>I hope that helps.

What is this block of code actually doing? <br> <br>location / { <br>expires 8d; <br>proxy_set_header X-Real-IP $remote_addr; <br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; <br>proxy_set_header X-Forwarded-Proto $scheme; <br>proxy_set_header Host $http_host; <br>proxy_set_header X-NginX-Proxy true; <br>proxy_read_timeout 5m; <br>proxy_connect_timeout 5m; <br>proxy_pass http://127.0.0.1:1337; <br>proxy_redirect off; <br>proxy_set_header Upgrade $http_upgrade; <br>proxy_set_header Connection “upgrade”; <br>} <br> <br>Is this in the default.conf file? Or is this the customized config file in the sites-available directory?

I don’t see any of csbukhari.com or www.csbukhari.com there, are you sure this is the only config file?

my conf file <br>server {
<br> listen 80; <br> server_name blog.csbukhari.com; <br> <br> client_max_body_size 10M; <br> <br> location / { <br> proxy_pass http://localhost:2368/; <br> proxy_set_header Host $host; <br> proxy_buffering off; <br> } <br>} <br> <br> <br>i do it but i dosent work <br>

You need to make sure your DNS points www either to an A record or a CNAME record. <br> <br>As for the subdomain you can do <br> <br>server { <br> listen 80; <br> server_name subdomain.domain.tld <br> <br> location / { <br> expires 8d; <br> proxy_set_header X-Real-IP $remote_addr; <br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; <br> proxy_set_header X-Forwarded-Proto $scheme; <br> proxy_set_header Host $http_host; <br> proxy_set_header X-NginX-Proxy true; <br> proxy_read_timeout 5m; <br> proxy_connect_timeout 5m; <br> proxy_pass http://127.0.0.1:1337; <br> proxy_redirect off; <br> proxy_set_header Upgrade $http_upgrade; <br> proxy_set_header Connection “upgrade”; <br> } <br>} <br> <br> <br>This is just an example, but change the server name and the proxy_pass and it should work fine <br>