You're viewing old version number 5. - Current version

2 min

Installing nodejs, nginx, and ghost on Digital Ocean Droplet

Week of November 10, 2013

- networksolutions.com
-- buy a domain name.

- digitalocean.com
-- create an account
-- purchase the $5 per month Droplet.
--- I used Ubuntu Linux.
-- Digital Ocean will e-mail the username and password for the Linux server. This info is used to log into the server with SSH.
-- while logged into the Digital Ocean dashboard:
--- click DNS and add the domain name purchased above. the domain name will be associated with the droplet created, but also need to add the domain name to the DNS setting.
--- add the Digital Ocean name servers to the Network Solutions account for the domain name.

- log into the Digital Ocean server and change the password.
- have root access to the server.
- it's clean, simple, bare-bones Linux install.
- need to install gcc.
- need to install unzip.
- need to isntall curl.

Installing Node.js

https://www.digitalocean.com/community/articles/how-to-install-an-upstream-version-of-node-js-on-ubuntu-12-04

sudo apt-get update

sudo apt-get install build-essential

sudo apt-get install curl

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc

. ~/.bashrc

mkdir ~/local
mkdir ~/node-latest-install

cd ~/node-latest-install

curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1

./configure --prefix=~/local

(this step takes a while)
make install

curl https://npmjs.org/install.sh | sh

node -v
(returns v0.10.21)

Installing Nginx

http://0v.org/installing-ghost-on-ubuntu-nginx-and-mysql

sudo apt-get install nginx

sudo mkdir /var/cache/nginx
sudo chown www-data:www-data /var/cache/nginx

sudo mkdir /var/www
sudo chown www-data:www-data /var/www

vi /etc/nginx/nginx.conf

(Delete everything and replace it with the text below.)

user <a href="http://www-data;">www-data;</a>
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    proxy_cache_path  /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
    proxy_temp_path /var/tmp;
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    gzip on;
    gzip_comp_level 6;
    gzip_vary on;
    gzip_min_length  1000;
    gzip_proxied any;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    gzip_buffers 16 8k;

    upstream ghost_upstream {
      server 127.0.0.1:2368;
      keepalive 64;
    }

    server {
    listen 80;

    server_name YOUR_DOMAIN <a href="http://www.YOUR_DOMAIN;">www.YOUR_DOMAIN;</a>

    if ($host = 'YOUR_DOMAIN' ) {
            rewrite  ^/(.*)$  <a href="http://www.YOUR_DOMAIN/">http://www.YOUR_DOMAIN/</a>$1  permanent;
    }

#        location ~ ^/(ghost/signup/) {
#                rewrite ^/(.*)$ <a href="http://YOUR_DOMAIN/">http://YOUR_DOMAIN/</a> permanent;
#        }

    location ~ ^/(img/|css/|lib/|vendor/|fonts/|robots.txt|humans.txt) {
      root /var/www/core/client/assets;
      access_log off;
      expires max;
    }

    location ~ ^/(shared/|built/) {
      root /var/www/core;
      access_log off;
      expires max;
    }

    location ~ ^/(favicon.ico) {
      root /var/www/core/shared;
      access_log off;
      expires max;
    }

    location ~ ^/(content/images/) {
      root /var/www;
      access_log off;
      expires max;
    }

    location / {
      proxy_redirect off;
      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;
      proxy_set_header   Host                   $http_host;
      proxy_set_header   X-NginX-Proxy    true;
      proxy_set_header   Connection "";
      proxy_http_version 1.1;
      proxy_cache one;
      proxy_cache_key ghost$request_uri$scheme;
      proxy_pass         <a href="http://ghost_upstream;">http://ghost_upstream;</a>
    }
    }

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

(Now you need to edit the contents and replace everywhere it says YOUR_DOMAIN with your actual domain like example.com.)

(You can now restart nginx:)
sudo /etc/init.d/nginx restart

Installing and Configuring Ghost

http://0v.org/installing-ghost-on-ubuntu-nginx-and-mysql

From JR's : articles
446 words - 4389 chars - 2 min read
created on
updated on - #
source - versions



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: May 5, 2024 - 4:58 p.m. EDT