Nginx configuration - ruby-on-rails

When I run
sudo mate /opt/nginx/conf/nginx.conf
my nginx.conf file opens but is blank, what did i do wrong?
trying to deploy my rails app to a ubuntu 10.04 lucid with passenger, nginx, and REE

On which machine are you running "sudo mate ..."? If you're trying to deploy, you should be on the Ubuntu server. I suspect you're using a Mac for development and the command you've issued is to edit the local nginx installation on your Mac, not on the deployment server.

You can check where you are with command:
$ uname -a

Are you sure you're not looking for:
sudo nano /etc/nginx/nginx.conf
on your server?

Related

Windows WLS, Postgresql on Windows and Rails, cannot build a db

I'm trying to work with Windows WLS.
I have installed ruby and rails and they work (apart the annoying warning).
I've installed postgresql client on Ubuntu/WLS, and postgresql server on windows.
When i try to connect via:
psql -p 5432 -h localhost -U postgres
all run correctly.
When i try to launch:
rails db:create
i have this error:
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"
The error can means that the Postgresql server is not running. Try starting it
sudo systemctl start postgresql
and Make sure that the server starts on boot:
sudo systemctl enable postgresql
or
This issue can comes from installing the postgres package without a version number.
sudo apt-get remove --purge postgresql
and reinstall
sudo apt-get install postgresql-(what is the current version)
Resolved. If someone needs, in the configuration file we need to add host: localhost

Error in Docker: bad address to executables

I'm trying to something with Docker.
Steps I'm doing:
- Launch Docker Quickstart Terminal
- run docker run hello-world
Then I get error like:
bash: /c/Program Files/Docker Toolbox/docker: Bad address
I have to say that I was able to run hello-world image, but now I'm not. I don't know what happend.
I don't know if it matters however I had some problems at instalation step.
Since I have git installed in non standard location. However it seems git bash.exe working correctly for Docker.
My environment:
Windows 10
Git 2.5.0 (installed before Docker)
Docker Toolbox 1.9.1a
I have the same issue with bash: /c/Program Files/Docker Toolbox/docker: Bad address
I thought the problems is "bash doesn't support docker.exe".
SO I fix this problem by use powershell ,not the bash.
and if you use powershell maybe face this
An error occurred trying to connect: Get http://localhost:2375/v1.21/containers/json: dial tcp 127.0.0.1:2375: ConnectExenter code here
tcp: No connection could be made because the target machine actively refused it.
You can export variable from bash use export and import to powershell by this below
$env:DOCKER_HOST="tcp://192.168.99.100:2376"
$env:DOCKER_MACHINE_NAME="default"
$env:DOCKER_TLS_VERIFY="1"
$env:DOCKER_TOOLBOX_INSTALL_PATH="C:\\Program Files\\Docker Toolbox"
$env:DOCKER_CERT_PATH="C:\\Users\\kk580\\.docker\\machine\\machines\\default"
that's all
ps:I found this problem fixed by update git from 2.5.0 to 2.6.3.
Not entirely sure what the issue is, report it to the project on github. I find the docker mac and windows tools a bit flakey from time to time as they are still maturing. If you don't mind seeing what's underneath, you can try running docker-machine directly or set up your own host pretty quickly with Vagrant.
Docker Machine
Run a command or bash prompt to see what machines you have.
docker-machine ls
Create a machine if you don't have one listed
docker-machine create -d "virtualbox" default-docker
Then connect to the listed machine (or default-docker)
docker-machine ssh default-docker
Vagrant
If that doesn't work you can always use vagrant to manage VM's
Install VirtualBox (Which you probably have already if you installed the toolbox)
Reinstall Git, make sure you select the option for adding ALL the tools to your system PATH (for vagrant ssh)
Install Vagrant
Run a command or bash prompt
mkdir docker
cd docker
vagrant init debian/jessie64
vagrant up --provider virtualbox
Then to connect to your docker host you can run (from the same docker directory you created above)
vagrant ssh
Now your on the docker host, Install the latest docker the first time
curl https://get.docker.com/ | sudo sh
Docker
Now you have either a vagrant or docker-machine host up, you can docker away after that.
sudo docker run -ti busybox bash
You could also use PuTTY to connect to vagrant machines instead of installing git/ssh and running vagrant ssh. It provides a nicer shell experience but it requires some manual setup of the ssh connections.

Nginx Install doesn't create /etc/rc.d/init.d/nginx

I'm installing Nginx using Passenger on an ubuntu server. I install Nginx using rvmsudo passenger-install-nginx-module but when I try to create a Nginx script using nano /etc/rc.d/init.d/nginx the directory rc.d does not exist. Any idea why?
I have the directories rc0.d through rc6.d but none of them have the init.d file in them. I'm following the Digital Ocean Tutorial
This is explained in detail in the Passenger documentation here: https://www.phusionpassenger.com/library/install/nginx/install/oss/rubygems_rvm/#note_about_nginx
The solution is to install Nginx from the Phusion Passenger APT repository, or to create an Nginx init script yourself.

Deploying Rails app using Nginx, Unicorn, Postgres and Capistrano to Digital Ocean : nginx eror

I have done all the steps by using this tutorial but while running below statement, I am getting the following error. I have created my Digital Ocean VPS host in port 3000.
$ sudo rm /etc/nginx/sites-enabled/default
$ sudo service nginx restart
* Restarting nginx nginx [fail]
$ sudo nginx -t
nginx: [emerg] "listen" directive is not allowed here in /etc/nginx/sites-enabled/hosting:1
nginx: configuration file /etc/nginx/nginx.conf test failed
Check for the solution here:
Nginx unknown directive "upstream" error when deploying Rails
That guy followed the same tutorial, and had the exact same problem. He also posted a solution.
Also, to avoid the issue altogether, you might consider using this plugin: https://github.com/bruno-/capistrano-unicorn-nginx

Can't configure thin to start at system boot on CentOs

I can't configure thin to start at system boot, I am new to Linux
I have CentOS 5.7
Thin gem was installed and thin was installed too.
sudo gem install thin
sudo thin install
and when I try to configure thin to start at system boot I get an error
sudo /sbin/chkconfig --level 345 thin on
error reading information on service thin: No such file or directory
Anybody have an idea why I get this error?
Thanks,
sudo mv /etc/rc.d/thin /etc/rc.d/init.d/thin, and retry.

Resources