Git Product home page Git Product logo

website's People

Watchers

 avatar

website's Issues

Ideas

  • yacht - order mutators
  • yacht - collect vs array - you might not need a collection
  • yacht - factory()->raw()
  • web developer without a web server
  • UX na yachtach: confirm modal. Why did I delete X button in the right corner

spinning up a webserver

Update apt

apt update && apt upgrade -y

Configuring the locale

echo 'export LC_ALL="en_US.UTF-8"' >> /root/.bashrc && source /root/.bashrc

Creating 'deploy' user

We start by creating the user, adding it to the www-data group and setting their shell to bash.

useradd --groups sudo,www-data --create-home --shell /bin/bash deploy

Next, we set their password to secret.

echo deploy:secret | chpasswd

And finally, we configure their locale.

echo 'export LC_ALL="en_US.UTF-8"' >> /home/deploy/.bashrc

Generating SSH keys for deploy user

su -c 'ssh-keygen -t rsa -b 4096 -f /home/deploy/.ssh/id_rsa -P "" -C "$(whoami)@$(hostname)"' deploy
su -c "echo '$(cat /root/.ssh/authorized_keys)' > /home/deploy/.ssh/authorized_keys" deploy

Configuring SSH daemon

sed -i "s/PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config
service sshd restart

Adding necessary repositories

add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:ondrej/nginx
add-apt-repository -y ppa:certbot/certbot
apt update

Dunno, essentials?

apt install -y build-essential

Installing NGINX

apt install -y nginx
chown deploy:www-data -R /var/www/

Installing PHP

apt install -y php7.2-fpm php7.2-cli php7.2-mbstring php7.2-xml php7.2-zip php7.2-mysql

Installing composer

curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

Installing MYSQL

apt install -y mysql-server
mysql_secure_installation

Installing nodejs + yarn

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
curl -sL https://deb.nodesource.com/setup_9.x | bash -
apt install -y nodejs yarn

NGINX config

server {
    listen 80;
    listen [::]:80;

    server_name _;

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443;

    ssl_certificate /etc/letsencrypt/live/_/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/_/privkey.pem;

    server_name _;
    root "/var/www/default/public";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /\.ht {
        deny all;
    }
}
service nginx reload

Firewall: UFW

ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow http
ufw allow https
ufw enable

Certbot certificate

apt-get install -y software-properties-common python-certbot-nginx

Laravel specific

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

vim: searching

  • find letter
    • find next occurrence: f<letter>
    • find previous occurrence: F<letter>
    • find next occurrence, and jump just before: t<letter>
    • find previous occurrence, and jump just before: T<letter>
    • repeat last search (f, F, t, T): ;
  • find word: /<word>
    • next occurrence: n
    • previous occurrence: N
  • repeat last command: .

http://vim.wikia.com/wiki/All_the_right_moves

using screen in linux

screen # start a new screen session
<ctrl> A d # detach from the current session
screen -r <sessionId?> # reattach the specified session (or the last one)
screen -ls # list all sessions

deploy.blade.php

@servers(['web' => '[email protected]'])

@task('deploy', ['on' => 'web'])
    cd /var/www/default

    echo "=> Running 'git pull origin master'..."
    git pull origin master --quiet

    echo "=> Running 'composer install'..."
    composer install --quiet --optimize-autoloader

    echo "=> Running 'php artisan migrate'..."
    php artisan migrate --quiet --force

    echo "=> Running 'yarn install'..."
    yarn install --silent

    echo "=> Running 'yarn production'..."
    yarn production
@endtask

netcat - testing connection

NETCAT

nc -l 8000 < ./http-response # run tcp server on port 8000 (server contents from ./file)

while(true); do nc -l 8000 < ./http-response; done # simulate "server"

nc jerguslejko.com 90 < ./http-request # send raw request


nc -l 8000 <(echo "hey there")

# or 

echo "hey there" | nc -l 8000

nc response must by at least 5 characters ????

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.