server {
listen *:80; # port http
set $https off;
location / {
proxy_pass http://dutybalancer;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen *:443 ssl; # port https
set $https on;
... тут немного сертификатов
location / {
proxy_pass https://dutybalancer_ssl;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
...
location ... {
...
fastcgi_pass ...;
fastcgi_param MY_PARAM "123";
...
}
...
$pdo = new PDO("mysql:host=localhost;dbname=...;","db_user","password");
$statement = $pdo->prepare(
"SELECT * FROM posts p JOIN posts_category pc ON pc.category_id = p.posts_category_id
WHERE pc.category_alias = ?"
);
$statement->bindValue(1, $name, \PDO::PARAM_STR);
$statement->execute();
$result = $statement->fetchAll(\PDO::FETCH_ASSOC);
...
while($city = $result->fetch_assoc()) {
$array[mb_substr($city['city_name'], 0, 1, 'UTF-8')][] = $city;
}
...
location /somefile.php\?.* {
error_page 418 = @with_id;
recursive_error_pages on;
if ($args ~ id=) {
return 418;
}
#without id
...
}
location @with_id {
...
}
function isFirefox() {
return navigator.userAgent.toLowerCase().indexOf('firefox') != -1;
}