Ответы пользователя по тегу Ubuntu
  • Можно ли осуществить перенаправление пакетов, что бы открывались 2 сайта?

    @HomeDimoN
    1. Перейти на nginx на сервере owncloud (или поставить как еще один, или поставить на отдельный сервер)
    2. Создать конфиги nginx для обоих сайтов
      server {
          listen       80;
          server_name  data.exemple.com;
      
          if ($http_host ~ "(?i)(data\.exemple\.com)$") {
      	rewrite ^(.*)  /web/$1 last;
          }
      
          location /web// {
      	proxy_pass http://data.exemple.com;
      	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-Host $server_name;
      	proxy_read_timeout 500;
          }
      
          location / {
              root   /usr/share/nginx/html;
              index  index.html index.htm;
          }
      
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   /usr/share/nginx/html;
          }
      }

      второй по анологии

    3. отказаться от http в ползу https пример для exchange (не забыть подложить сертификаты в /etc/nginx/conf.d/cert/)
      server {
          listen      443;
      
          ssl on;
          ssl_certificate         /etc/nginx/conf.d/cert/mail.crt;
          ssl_certificate_key     /etc/nginx/conf.d/cert/mail.key;
          ssl_protocols         TLSv1 TLSv1.1 TLSv1.2;
          server_name  mx.example.com;
      
          #charset koi8-r;
          #access_log  /var/log/nginx/log/host.access.log  main;
      
          if ($http_host ~ "(?i)(mx\.example\.com)$") {
      	rewrite ^(.*)  /web/$1 last;
          }
      
          location /web// {
      	proxy_pass https://mx.example.com;
      	proxy_redirect     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;
              proxy_set_header   X-Forwarded-Host $server_name;
      	proxy_read_timeout 500;
          }
      
          location / {
              root   /usr/share/nginx/html;
              index  index.html index.htm;
          }
      
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   /usr/share/nginx/html;
          }
      }


    Ответ написан