# Digital Ocean Access and Operation
## Source article
[The below is a summary of this article](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04)
## Step by step
### Access
`ssh root@SERVER_IP_ADDRESS`
### PM2
PM2 provides an easy way to manage and daemonize applications (run them in the background as a service)
If not already installed, install PM2
`sudo npm install -g pm2`
Use the pm2 start command to run your application in the background:
`pm2 start index.js` where index.js is the start file (in my case likely an express server file)
### Nginx
When you use a URL without a port included your browser assumes it is port 80 (or 443 for HTTPS). Using anything else requires it to be specified. Generally with modern apps using Rails, a JavaScript framework or something other than static HTML or PHP scripts you will use a reverse proxy web server in front of the app to process requests (this also automatically gives you nice standard access logs). What you can do is:
First install nginx
`sudo apt-get update;`
`sudo apt-get install nginx;`
Then once it's installed, edit the nginx configuration file in /etc/nginx/sites-enabled/ so it reads like:
```
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:3000; // where 3000 is your local port
proxy_set_header Host $host;
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;
}
}
```
Make sure you didn't introduce any syntax errors by typing:
`sudo nginx -t`
Then restart nginx:
`service nginx restart`