Skip to content

Instantly share code, notes, and snippets.

View liathit's full-sized avatar
🎯
Focusing

Serge Suvorov liathit

🎯
Focusing
View GitHub Profile

Deploying Django with Gunicorn, Nginx and MySQl on Ubuntu 18.04

Setting up software

  1. Update ubuntu software repository
  2. Install
    1. nginx - Serve our website
    2. mysql-server and libmysqlclient-dev - For database
    3. Python 3
  3. ufw - Firewall for our system
@liathit
liathit / nginx-stat-failed-13-permission-denied.md
Created July 30, 2024 13:50 — forked from windsting/nginx-stat-failed-13-permission-denied.md
fix: Nginx: stat() failed (13: permission denied)

Nginx: stat() failed (13: permission denied)

from https://stackoverflow.com/questions/25774999/nginx-stat-failed-13-permission-denied

Nginx operates within the directory, so if you can't cd to that directory from the nginx user then it will fail (as does the stat command in your log). Make sure the www-user can cd all the way to the /username/test/static. You can confirm that the stat will fail or succeed by running

sudo -u www-data stat /username/test/static
[Recent File List]
file0=C:\users\liathit\My Documents\LTspiceXVII\plot.defs
file1=Z:\home\liathit\Downloads\clapp.asc
file2=Z:\home\liathit\Downloads\Base_Biased_Circuits.asc
file3=Z:\home\liathit\Downloads\Draft2.asc
file4=Z:\home\liathit\Downloads\BJT_Characteristic_Curves.asc
file5=Z:\home\liathit\Downloads\Draft4.asc
file6=Z:\home\liathit\Downloads\Emitter_Amplifier.asc
file7=Z:\home\liathit\Downloads\Draft1.asc
file8=Z:\home\liathit\Downloads\filter.asc
@liathit
liathit / guestfish.txt
Last active November 2, 2016 00:56
changing_password_kvm_qcow_image
yum -y install libguestfs-tools
root@box1 # guestfish --rw -a ./rhel-guest-image-7.1-20150224.0.x86_64.qcow2
><fs> run
><fs> list-filesystems
><fs> mount /dev/sda1 /
><fs> vi /etc/shadow
NOTE: after you perform the following steps you use "quit" to exit.
@liathit
liathit / doseq.md
Created February 29, 2016 16:28
clojure-doseq

The difference is that for builds a lazy sequence and returns it while doseq is for executing side-effects and returns nil.

user=> (for [x [1 2 3]] (+ x 5)) (6 7 8) user=> (doseq [x [1 2 3]] (+ x 5)) nil user=> (doseq [x [1 2 3]] (println x)) 1

Mount the ISO:
sudo mount -t udf -o loop,ro,unhide /path/to/file.iso /mnt
Insert the USB drive.
Run fdisk and specify the device name of the USB drive; for example:
sudo fdisk /dev/sdc
@liathit
liathit / getset.py
Created July 22, 2015 09:39
setters/getters and inheritance in python
class One:
def __init__(self, value):
self.x = value
@property
def x(self):
return self.__x
@x.setter
def x(self, value):
@liathit
liathit / .tmux.conf
Created June 27, 2015 07:09
.tmux.conf
set -g default-terminal "screen-256color"
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
set -g mode-keys vi
set-option -g default-shell /usr/bin/bash
set-option -g status-position bottom
set-option -g set-titles-string '#{pane_current_command}'
@liathit
liathit / .nvimrc
Created June 27, 2015 07:09
.nvimrc
set number
set cursorline
set autoindent
set smarttab
set shiftwidth=4
set encoding=utf-8
set noswapfile
set t_Co=256
set mouse=a
set autochdir
@liathit
liathit / gist:8942d665c95541a7dd02
Created April 30, 2015 04:39
structure of a flask app as package
note-flask-app
├── config.py
├── note-flask-app
│   ├── forms.py
│   ├── __init__.py
│   ├── models.py
│   ├── templates
│   └── views.py
├── requirements.txt
└── run.py