$ nano /etc/hosts
127.0.0.1 localhost
127.0.1.1 user-UBUNTU
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 domain.dev
127.0.0.1 api.domain.dev
127.0.0.1 test.domain.dev
server {
listen 80;
server_name api.domain.ru www.api.domain.ru;
proxy_set_header Host api.domain.ru;
location / {
rewrite ^(.*)$ https://api.domain.ru$1 permanent;
}
return 301 https://api.domain.ru$request_uri;
}
server {
listen 443 ssl http2;
server_name api.domain.ru www.api.domain.ru;
#......................
}
#################################################################
server {
listen 80;
server_name domain.ru www.domain.ru;
proxy_set_header Host domain.ru;
location / {
rewrite ^(.*)$ https://domain.ru$1 permanent;
}
return 301 https://domain.ru$request_uri;
}
server {
listen 443 ssl http2;
server_name domain.ru www.domain.ru;
#.......................
}
#!/bin/bash
# Usage:
# sudo ~/letsencrypt/addnew.sh domain.ru
set -e
DOMAIN="$1"
sudo letsencrypt certonly -a webroot --webroot-path=/var/www/html -d ${DOMAIN} -d www.${DOMAIN}
#openssl dhparam -out /etc/pki/nginx/dhparam.pem 4096
echo -e '
*********************************************************************
NGINX config add:
ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem;
ssl_dhparam /etc/pki/nginx/dhparam.pem;
*********************************************************************
'
#!/bin/bash
# This script renews all the Let's Encrypt certificates with a validity < 30 days
# Usage:
# run command:
# sudo crontab -e
# add string
# @daily /home/vpsuser/letsencrypt/letsencrypt.cron.sh
# run command:
# chmod +x /home/vpsuser/letsencrypt/letsencrypt.cron.sh
NGINX=$(which nginx)
if ! /usr/bin/letsencrypt renew > /var/log/letsencrypt/renew.log 2>&1 ; then
echo Automated renewal failed:
cat /var/log/letsencrypt/renew.log
exit 1
fi
${NGINX} -t && service nginx restart
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.php;
server_name _;
location / {
try_files $uri $uri/ =404;
}
# For LetsEncrypt: https://letsecure.me/secure-web-deployment-with-lets-encrypt-and-nginx/
location ~ /.well-known/acme-challenge {
allow all;
}
}
var balance = 10500;
var cameraOn = true;
function steal(amount) {
cameraOn = false;
if (amount < balance) {
balance = balance - amount;
}
return amount;
cameraOn = true;
console.log("Не работает");
}
var amount = steal(1250);
console.log("Criminal: you stole " + amount + "!" + " И оставил на счету " + balance);
User.find({
email: req.body.email,
password: User.hashPassword(req.body.password)
}, (err, user) => {
if(err) {
return res.status(400).json({error: err});
}
if(user) {
let data = JSON.parse(JSON.stringify(user, ['allow', 'fields', 'in', 'array']));
return res.status(200).json(data);
}
});