server {
listen 80 ;
server_name portal.mysite.ru;
access_log /var/log/nginx/portal_access.log main;
error_log /var/log/nginx/portal_error.log warn;
#charset utf-8;
server_name_in_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:80;
location ~ ^(/.well-known/acme-challenge/) {
proxy_pass "http://127.0.0.1:8887";
proxy_connect_timeout 10;
root /home/bitrix/ext_www/portal.mysite.ru;
}
# Redirect to ssl if need
if (-f /home/bitrix/ext_www/portal.mysite.ru/.htsecure) { rewrite ^(.*)$ https://$host$1 permanent; }
location ~ ^(/) { proxy_pass "http://192.168.37.200:80"; proxy_connect_timeout 10; }
location ~ ^(/).*/$ { proxy_pass "http://192.168.37.200:80"; proxy_connect_timeout 10; }
}
server {
listen 443 http2;
server_name portal.mysite.ru;
access_log /var/log/nginx/portal_access.log main;
error_log /var/log/nginx/portal_error.log warn;
server_name_in_redirect off;
# CERTIFICATE ANSIBLE MANAGED BLOCK
include bx/conf/ssl_options.conf;
ssl_certificate /etc/letsencrypt/live/portal.mysite.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/portal.mysite.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/portal.mysite.ru/chain.pem;
# CERTIFICATE ANSIBLE MANAGED BLOCK
location ~ ^(/){
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://192.168.37.200;
proxy_read_timeout 90;
proxy_connect_timeout 10;
proxy_redirect http://192.168.37.200:80 https://portal.mysite.ru;
}
location ~ ^(/).*/$ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://192.168.37.200;
proxy_read_timeout 90;
proxy_connect_timeout 10;
proxy_redirect http://192.168.37.200:80 https://portal.mysite.ru;
}
# Include parameters common to all websites
include bx/conf/bitrix.conf;
# Include munin and nagios web
include bx/server_monitor.conf;
}
# Default website
server {
listen 80 default_server;
server_name _;
server_name_in_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:80;
set $proxyserver "http://127.0.0.1:8888";
set $docroot "/home/bitrix/www";
index index.php;
root /home/bitrix/www;
# Redirect to ssl if need
if (-f /home/bitrix/www/.htsecure) { rewrite ^(.*)$ https://$host$1 permanent; }
# Include parameters common to all websites
include bx/conf/bitrix.conf;
# Include server monitoring locations
include bx/server_monitor.conf;
}
server {
######################################################################
## Server configuration
######################################################################
listen *:443 ssl http2;
server_name 3dpaneli.ru www.3dpaneli.ru ;
root /var/www/3dpaneli.ru/web;
######################################################################
## Enable gzip for proxied requests and static files
######################################################################
# Enable gzip for proxied requests and static files
gzip on;
gzip_proxied any;
gzip_vary on;
gzip_http_version 1.1;
gzip_types application/javascript application/json text/css text/xml;
gzip_comp_level 4;
######################################################################
## SSL configuration
######################################################################
# recommended but not manditory directive
# leave commented out unless you know what it is doing
#more_set_headers 'Strict-Transport-Security: max-age=15768000';
ssl on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1h;
ssl_protocols TLSv1.2 TLSv1.3;
add_header Strict-Transport-Security "max-age=15768000" always;
ssl_stapling on;
ssl_stapling_verify on;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_certificate /var/www/clients/client132/web171/ssl/3dpaneli.ru-le.crt;
ssl_certificate_key /var/www/clients/client132/web171/ssl/3dpaneli.ru-le.key;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
######################################################################
## Log configuration
######################################################################
#Все логи отключены
error_log /dev/null crit;
access_log off;
######################################################################
## Errors send to apache2
######################################################################
# у апача своих алиасов куча, а так же некоторая статика отдается
# средствамси php, по этому все ошибки обрабатывать только apache2
error_page 401 403 404 405 500 502 503 = @fallback;
location @fallback {
proxy_pass https://127.0.0.1:4443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header HTTPS YES;
}
######################################################################
## Locations configuration
######################################################################
#Отключаем логирование ошибок No such file or directory
## Disable .htaccess files
location ~ /\.ht {
deny all;
access_log off;
log_not_found off;
}
##
location = /favicon.ico {
log_not_found off;
access_log off;
}
##
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
##
######################################################################
# сервисы на сайте phpmyadmin почта и letxencrypt
location /phpmyadmin/ {
deny all;
root /usr/share/phpmyadmin/;
}
##
location /webmail/ {
rewrite ^/(.*)$ https://$http_host:8080/$1 permanent;
}
# letsencrypt
location /.well-known/acme-challenge/ {
alias /usr/local/ispconfig/interface/acme/;
default_type text/plain;
}
# static content
# Отдаем статику напрямую с nginx
location ~* ^.+\.(jpg|jpeg|svg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|flv|mp3)$ {
root /var/www/3dpaneli.ru/web;
access_log off;
expires max;
gzip_static on;
}
# default location
location / {
index index.php index.html index.htm;
proxy_pass https://127.0.0.1:4443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header HTTPS YES;
}
}
server {
listen *:80;
server_name 3dpaneli.ru www.3dpaneli.ru ;
root /var/www/3dpaneli.ru/web;
......
proxy_pass http://127.0.0.1:82;
....
}