Skip to content

Instantly share code, notes, and snippets.

@kirykr
Last active February 16, 2019 12:45
Show Gist options
  • Select an option

  • Save kirykr/cab6c9941550fdbd43e81d5cd8b2569d to your computer and use it in GitHub Desktop.

Select an option

Save kirykr/cab6c9941550fdbd43e81d5cd8b2569d to your computer and use it in GitHub Desktop.

Revisions

  1. kirykr revised this gist Feb 16, 2019. 1 changed file with 38 additions and 0 deletions.
    38 changes: 38 additions & 0 deletions SSL free using Let's encrypt for Nginx Ubuntu 16
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    First
    $ sudo apt-get update
    $ sudo apt-get install software-properties-common
    $ sudo add-apt-repository universe
    $ sudo add-apt-repository ppa:certbot/certbot
    $ sudo apt-get update

    Install and configure aws cli in the sever

    Install certbot-auto

    user@webserver:~$ wget https://dl.eff.org/certbot-auto
    user@webserver:~$ chmod a+x ./certbot-auto
    user@webserver:~$ ./certbot-auto --help
    $ ./certbot-auto plugins
    $ sudo apt-get install certbot python-certbot-nginx

    Run
    sudo certbot certonly --dns-route53 -i apache -d "*.example.com" -d example.com

    ln -s /etc/letsencrypt/live/romchong.com/fullchain.pem /opt/bitnami/apache2/conf/server.crt
    ln -s /etc/letsencrypt/live/romchong.com/privkey.pem /opt/bitnami/apache2/conf/server.key

    Edit
    vim /opt/bitnami/apps/wordpress/htdocs/wp-config.php
    Add to the very bottom of the file the following:
    define('WP_ENCRYPT_SSL_CERTIFICATES_DIR_PATH', '/etc/letsencrypt/live');

    Edit
    vim /opt/bitnami/apps/wordpress/conf/httpd-prefix.conf
    Add to the top of the file the following:

    ```
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
    ```

  2. kirykr revised this gist Feb 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ go to https://certbot.eff.org and select server platform you're using
    $ sudo apt-get install python-certbot-nginx
    $ pip install certbot-dns-route53 --user
    ```
    configure aws cli in the sever
    install and configure aws cli in the sever
    go to EC2 and allow inbounce traffic in Security group for HTTPS
    `sudo certbot certonly --dns-route53 --dns-route53-propagation-seconds 30 -i nginx -d www.example.com -d example.com`

  3. kirykr revised this gist Nov 30, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,5 @@ go to EC2 and allow inbounce traffic in Security group for HTTPS

    ---
    Ref: https://letsencrypt.org/getting-started/
    https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx
    https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx
    https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html#awscli-install-osx-path
  4. kirykr revised this gist Nov 30, 2018. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -14,3 +14,9 @@ go to https://certbot.eff.org and select server platform you're using
    configure aws cli in the sever
    go to EC2 and allow inbounce traffic in Security group for HTTPS
    `sudo certbot certonly --dns-route53 --dns-route53-propagation-seconds 30 -i nginx -d www.example.com -d example.com`



    ---
    Ref: https://letsencrypt.org/getting-started/
    https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx
  5. kirykr revised this gist Nov 30, 2018. 1 changed file with 41 additions and 0 deletions.
    41 changes: 41 additions & 0 deletions default
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    client_max_body_size 30M;

    server {
    listen 80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
    }

    server {
    listen 443;
    server_name _;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/www.cam-sport-training-center.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.cam-sport-training-center.com/privkey.pem;

    root /var/www/your-site-dir/current/public;

    location / {
    passenger_enabled on;
    rails_env staging;
    }

    location ~ \.(js|css|png|jpg|jpeg|gif|ico|html)$ {
    expires max;
    gzip_static on;
    add_header Cache-Control public;
    break;
    }

    location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
    }

    # Drop requests to non-rails requests
    location ~ \.(aspx|php|jsp|cgi|asp) {
    return 410;
    }
    }
  6. kirykr revised this gist Nov 30, 2018. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -8,5 +8,9 @@ go to https://certbot.eff.org and select server platform you're using
    $ sudo add-apt-repository universe
    $ sudo add-apt-repository ppa:certbot/certbot
    $ sudo apt-get update
    $ sudo apt-get install python-certbot-nginx
    ```
    $ sudo apt-get install python-certbot-nginx
    $ pip install certbot-dns-route53 --user
    ```
    configure aws cli in the sever
    go to EC2 and allow inbounce traffic in Security group for HTTPS
    `sudo certbot certonly --dns-route53 --dns-route53-propagation-seconds 30 -i nginx -d www.example.com -d example.com`
  7. kirykr created this gist Nov 30, 2018.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    go to `https://letsencrypt.org/getting-started/` read the doc
    go to https://certbot.eff.org and select server platform you're using

    ** Install
    ```
    $ sudo apt-get update
    $ sudo apt-get install software-properties-common
    $ sudo add-apt-repository universe
    $ sudo add-apt-repository ppa:certbot/certbot
    $ sudo apt-get update
    $ sudo apt-get install python-certbot-nginx
    ```