понедельник, 26 сентября 2016 г.

Some links

Postgress:

1. Configuration: http://www.iakovlev.org/index.html?p=1431&m=1
2. Book: http://postgresql.leopard.in.ua/html/
3. Replication: http://eax.me/postgresql-replication/

https://habrahabr.ru/post/268631/

пятница, 29 января 2016 г.

Update ruby version on Ubuntu nginx.

> rvm install ruby-2.1.8

> rvm use 2.1.8@xan --create

and

> gem install bundler

Edit nginx.cof

> sudo vi /opt/nginx/conf/nginx.conf

server{
......
   passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.1.8/wrappers/ruby;
   passenger_enabled on;
   rails_env staging;
......
}

restart nginx.

среда, 14 января 2015 г.

Forward local emails to external email

Very often when you go to server via ssh you see:

You have mail.

Which you can see into /var/mail/ubuntu. Yep yo can see it on server by mutt.
Other solution is to forward it to another email which you check daily:

1. Instal mailx. To check all is ok:

#echo 'it is test' | mailx -s 'test email' 'my@email.com'

2. https://help.ubuntu.com/community/PostfixBasicSetupHowto#Per_User_.forward_Files
Add your email to the .forward file into home folder:

Per User .forward Files

Users can control their own mail delivery by specifying destinations in a file called .forward in their home directories. The syntax of these files is the same as system aliases, except that the lookup key and colon are not present.
I will illustrate an example here:
Assume that you need to forward all the mails which come to the sysadmin account to an another account. Enter the following commands:
su - sysadmin
touch .forward
Then open the .forward file
vi .forward
Add the following code:
fossedu@example.com
Remember to use email address which exists in this exercise.


Now send a mail to sysadmin and mail should come to fossedu@example.com


пятница, 2 января 2015 г.

Creating New Admin Users into CouchDB

Creating New Admin Users

Let’s do another walk through the API using curl to see how CouchDB behaves when you add admin users.
> HOST="http://127.0.0.1:5984"
> curl -X PUT $HOST/database
{"ok":true}
When starting out fresh, we can add a database. Nothing unexpected. Now let’s create an admin user. We’ll call her anna, and her password is secret. Note the double quotes in the following code; they are needed to denote a string value for the configuration API (as we learned earlier):
curl -X PUT $HOST/_config/admins/anna -d '"secret"'
""

From: http://guide.couchdb.org/draft/security.html

пятница, 31 октября 2014 г.

301 redirect from http to https + nginx

http://serverfault.com/questions/67316/in-nginx-how-can-i-rewrite-all-http-requests-to-https-while-maintaining-sub-dom

188down voteaccepted

Correct way in new versions of nginx

Turn out my first answer to this question was correct at certain time, but is tunred into another pitfall, to stay up to date please check Taxing rewrite pitfalls
I have been corrected by many SE users, so the credit goes to them, but more important, here is the correct code:
server {
       listen         80;
       server_name    my.domain.com;
       return         301 https://$server_name$request_uri;
}

server {
       listen         443 ssl;
       server_name    my.domain.com;

       [....]
}

четверг, 30 октября 2014 г.

SSL + Comodo + Faye

I have the comodo ssl cert and couple files. To create correct cry file:
1. Create PositiveSSL.ca_bundle:

#cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > PositiveSSL.ca-bundle

2. Add the ca_bundle to your example_com.crt:

#cat PositiveSSL.ca-bundle >> example_com.crt

And next use the new example_com.crt and example_com.key(it is your private key).

It solved the faye issue:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Links:

:)