Данная пошаговая инструкция поможет освоить основы на простом примере
Для справки
Сервер поднимался на Debian 8
c характеристиками:
CPU - 1 ядро x 500 МГц
<?php | |
namespace Burov\Handlers; | |
use Bitrix\Main\Loader; | |
use Bitrix\Sale\Location; | |
use Bitrix\Main\GroupTable; | |
/** |
<?php | |
// This can be found in the Symfony\Component\HttpFoundation\Response class | |
const HTTP_CONTINUE = 100; | |
const HTTP_SWITCHING_PROTOCOLS = 101; | |
const HTTP_PROCESSING = 102; // RFC2518 | |
const HTTP_OK = 200; | |
const HTTP_CREATED = 201; | |
const HTTP_ACCEPTED = 202; |
#!/bin/bash | |
# @author: Seb Dangerfield | |
# http://www.sebdangerfield.me.uk/?p=513 | |
# Created: 11/08/2011 | |
# Modified: 07/01/2012 | |
# Modified: 17/05/2012 | |
# Modify the following to match your system | |
NGINX_CONFIG='/etc/nginx/sites-available' | |
NGINX_SITES_ENABLED='/etc/nginx/sites-enabled' |
$dbElement = ElementTable::getList([ | |
'select' => ['ID', 'XML_ID', 'NAME', 'LINK', 'PROPERTY.ID', 'IBLOCK_ID'], | |
'filter' => [ | |
'=IBLOCK_ID' => 3, | |
'=LINK' => $elementID, | |
'=PROPERTY.CODE' => 'CML2_LINK' | |
], | |
'order' => ['ID'], | |
'runtime' => [ | |
'PROPERTY' => [ |
<?php | |
/** | |
* simple method to encrypt or decrypt a plain text string | |
* initialization vector(IV) has to be the same when encrypting and decrypting | |
* | |
* @param string $action: can be 'encrypt' or 'decrypt' | |
* @param string $string: string to encrypt or decrypt | |
* | |
* @return string | |
*/ |
<?php | |
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
// http://youtu.be/dQw4w9WgXcQ | |
// http://www.youtube.com/embed/dQw4w9WgXcQ | |
// http://www.youtube.com/watch?v=dQw4w9WgXcQ | |
// http://www.youtube.com/?v=dQw4w9WgXcQ | |
// http://www.youtube.com/v/dQw4w9WgXcQ | |
// http://www.youtube.com/e/dQw4w9WgXcQ | |
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ |
<?php | |
// Based on <https://github.com/mecha-cms/x.minify> | |
namespace x\minify\_ { // start namespace | |
$n = __NAMESPACE__; | |
\define($n . "\\token_boolean", '\b(?:true|false)\b'); | |
\define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+'); |
#!/bin/bash | |
if [ $(id -u) -eq 0 ]; then | |
read -p "Enter username : " username | |
read -s -p "Enter password : " password | |
egrep "^$username" /etc/passwd >/dev/null | |
if [ $? -eq 0 ]; then | |
echo "$username exists!" | |
exit 1 | |
else | |
pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) |
#!/usr/bin/env bash | |
# | |
# Nginx - new server block | |
# http://rosehosting.com | |
read -p "Enter username : " username | |
read -p "Enter domain name : " domain | |
# Functions | |
ok() { echo -e '\e[32m'$domain'\e[m'; } # Green | |
die() { echo -e '\e[1;31m'$domain'\e[m'; exit 1; } |