nano -w /etc/network/if-up.d/00-iptables
#!/bin/sh
iptables-restore < /etc/firewall.conf
ip6tables-restore < /etc/firewall6.conf
chmod +x nano -w /etc/network/if-up.d/00-iptables
iptables-save >/etc/firewall.conf
ip6tables-save >/etc/firewall6.conf
function getSome() {
return new Promise((resolve, reject) => {
request('https://site.ru', function (err, res, body) {
if (err) {
reject(err);
return;
}
resolve(body);
});
});
}
getSome().then(res => {
// do something with res
}).catch(err => {
// handle error
});
async foo() => {
const some = await getSome();
// use some
}
const rp = require('request-promise');
const getSome = async () => {
try {
const body = await rp({ uri: 'https://site.ru', json: true });
// do something other
return body;
} catch (err) {
// handle error
return err;
}
}
getSome().then(res => {
// do something with res
}).catch(err => {
// handle error
});
async foo() => {
const some = await getSome();
// use some
}
return 301 https://example.com/newPage$is_args$args;
return 301 https://example.com$request_uri;
proxy_pass http://…;
proxy_set_header Host <подставить>;
proxy_set_header Connection "";
# Также если нужно изменить путь, то, возможно, нужно добавить rewrite:
rewrite .* /newPath;
$text = "any text site1.ru site2.com mysite.ru";
$excludeSites = [ "mysite.ru" ];
foreach( $excludeSites as $siteID => $siteName )
{
$text = str_replace( $siteName, "{{SITE_ID_" . $siteID . "}}", $text );
}
$newText = preg_replace('@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@', '***', $text);
foreach( $excludeSites as $siteID => $siteName )
{
$newText = str_replace( "{{SITE_ID_" . $siteID . "}}", $siteName, $newText );
}
echo $newText;