пятница, 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:

:)

вторник, 28 октября 2014 г.

Install Jenkins on Ubuntu

    cd /home;
    sudo mkdir peter
    sudo chown peter:peter peter
    sudo usermod -d /home/peter peter

Nginx + jenkins config: http://programmingintraveling.blogspot.com/2014/10/nginx-jenkinx-config.html
:)

Chown how to

chown owner-user file
chown owner-user:owner-group file
chown owner-user:owner-group directory
chown options owner-user:owner-group file

Highlight syntax into Blogger

Charlock Holmes issue

After upgrading Ubuntu to 14.04 I have problem with charlock_holmes gem

/opt/extra/apps/project/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': libicuuc.so.48: cannot open shared object file: No such file or directory - /opt/extra/apps/project/shared/bundle/ruby/1.9.1/gems/charlock_holmes-0.7.3/lib/charlock_holmes/charlock_holmes.so (LoadError)

Solution: just delete bundled gems from project dir and run bundle.



#rm -rf /opt/extra/apps/project/shared/bundle
#bundle

Start service after reboot on Ubuntu

понедельник, 27 октября 2014 г.

Nginx + jenkins config

https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Nginx

server {
  listen 80;
  server_name jenkins.domain.tld;

  location / {
    proxy_pass              http://localhost:8080;
    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_connect_timeout   150;
    proxy_send_timeout      100;
    proxy_read_timeout      100;
    proxy_buffers           4 32k;
    client_max_body_size    8m;
    client_body_buffer_size 128k;

  }
}

Mailx - send email from Ubuntu terminal


I believe mailx is what you're looking for.
sudo apt-get install bsd-mailx 
This will also install postfix at a minimum, and will give you a few options to set postfix up. If you have an SMTP server on your LAN, choose 'satellite system', then enter the mail domain name, and lastly the IP address of your SMTP server.
To use:
echo $MESSAGE_BODY | /bin/mail -s "$SUBJECT" "$RECIPIENT_ADDRESS"
You can also use a file for the body:
/bin/mail -s "$SUBJECT" "$RECIPIENT_ADDRESS" < /tmp/message.txt
share|improve this answer
  
It says missing postfix/main.cf file , how can i download that file –  John Apr 27 '10 at 6:15
  
When you installed mailx it should have run through the install screens for postfix.  Did it ask you which type of install, and for the mail name and relay host?  And when does it give you the error, when you run /bin/mail or when you tried to install? –  nedm Apr 27 '10 at 6:21
  
it didn't ask me anything, how can uninstall it and do that again –  John Apr 27 '10 at 6:28
  
If you have postfix set up as part of another install it sounds like it may not be configured correctly.  Try      "sudo dpkg-reconfigure postfix"  and then     "sudo /etc/init.d/postfix reload"                 –                      nedm                 Apr 27 '10 at 6:28                                                                                                  
  
If postfix isn't installed, then "sudo apt-get remove mailx" and then "sudo apt-get install mailx" and it should install postfix with the mailx package. –  nedm Apr 27 '10 at 6:31


http://serverfault.com/questions/136106/what-package-to-install-for-sending-emails-from-localhost-ubuntu

Install imagemagick on Ubuntu 14.04

sudo apt-get install libmagickwand-dev imagemagick
http://superuser.com/questions/163818/how-to-install-rmagick-on-ubuntu-10-04