User Tools

Site Tools


сервис_http

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
сервис_http [2021/09/21 16:38]
val [Управление доступом к HTTP серверу на основе Basic аутентификации]
сервис_http [2023/09/17 20:11] (current)
val [Прокси "красивого" URL в приложение (пример 3)]
Line 33: Line 33:
     <META HTTP-EQUIV="​Content-Type"​ CONTENT="​text/​html;​charset=UTF-8">​     <META HTTP-EQUIV="​Content-Type"​ CONTENT="​text/​html;​charset=UTF-8">​
   </​HEAD>​   </​HEAD>​
-  <​BODY>​+  <​BODY ​text="​blue"​>
     <!--     <!--
       THis is comment       THis is comment
     -->     -->
 +    <PRE>
 +text
 +  as
 +    is
 +    </​PRE>​
     <​H1>​Go to Google</​H1>​     <​H1>​Go to Google</​H1>​
-    <A HREF=http://​freebsd.org/>​ +    <A HREF=https://​freebsd.org/>​ 
-    <IMG SRC=http://​www.freebsd.org/​logo/​logo-full.png>​+    <IMG SRC=https://​www.freebsd.org/​logo/​logo-full.png>​
     </​A> ​     </​A> ​
   </​BODY>​   </​BODY>​
Line 106: Line 111:
 </​code>​ </​code>​
  
 +==== Изменение порта ====
 +
 +  * [[https://​www.tecmint.com/​change-apache-port-in-linux/​|How to Change Apache HTTP Port in Linux]]
 ==== Свойство Indexes каталогов ==== ==== Свойство Indexes каталогов ====
  
Line 531: Line 539:
 ===== Поддержка протокола HTTPS ===== ===== Поддержка протокола HTTPS =====
  
 +  * [[Letsencrypt Certbot]]
 +  * [[https://​stackoverflow.com/​questions/​31370454/​sslcertificatechainfile-is-obsolete|SSLCertificateChainFile is now obsolete, and any intermediate certificates are supposed to be included in the server certificate file]]
 ==== Debian/​Ubuntu ==== ==== Debian/​Ubuntu ====
 <​code>​ <​code>​
Line 549: Line 559:
 </​code>​ </​code>​
  
 +==== Редирект HTTP на HTTPS ====
 +<​code>​
 +# a2enmod rewrite
 +
 +# cat /​etc/​apache2/​sites-available/​000-default.conf
 +</​code><​code>​
 +<​VirtualHost *:80>
 +...
 +    RewriteEngine On
 +    RewriteCond %{HTTPS} off
 +    RewriteRule (.*) https://​%{HTTP_HOST}%{REQUEST_URI}
 +...
 +</​code><​code>​
 +# service apache2 restart
 +</​code>​
 ==== FreeBSD ==== ==== FreeBSD ====
 <​code>​ <​code>​
Line 790: Line 815:
  
 [[http://​grolmsnet.de/​kerbtut/​firefox.html]] [[http://​grolmsnet.de/​kerbtut/​firefox.html]]
 +
 +==== Управление доступом к HTTP серверу с использованием OAuth2 аутентификации ====
 +
 +  * [[https://​github.com/​zmartzone/​mod_auth_openidc/​wiki/​GitLab-OAuth2]]
 +  * [[Инструмент GitLab#​Сервер OAuth2]] из GitLab
 +
 +<​code>​
 +gate# apt install libapache2-mod-auth-openidc
 +</​code><​code>​
 +gate# cat /​etc/​apache2/​sites-available/​000-default.conf
 +</​code><​code>​
 +...
 +        OIDCSSLValidateServer Off
 +        OIDCProviderMetadataURL https://​server.corp13.un/​.well-known/​openid-configuration
 +        OIDCRedirectURI http://​gate.corp13.un/​cgi-bin/​test-cgi
 +        OIDCClientID e...............................................4
 +        OIDCClientSecret 7.................................................4
 +        OIDCCryptoPassphrase anystring
 +...
 +</​code><​code>​
 +# cat /​etc/​apache2/​conf-available/​serve-cgi-bin.conf
 +</​code><​code>​
 +...
 +                        #Require all granted
 +                        AuthType openid-connect
 +                        Require valid-user
 +...
 +</​code><​code>​
 +Проверка:​ http://​gate.corp13.un/​cgi-bin/​test-cgi/ ​   !!! Последний / обязательно !!!
 +</​code>​
  
 ===== Протокол WebDAV ===== ===== Протокол WebDAV =====
Line 828: Line 883:
 <​code>​ <​code>​
 gate# apt install nginx gate# apt install nginx
 +</​code>​ 
 +==== Прокси "​красивого"​ URL в приложение (пример 1) ==== 
 +<​code>​
 gate# cat /​etc/​nginx/​sites-available/​user1 gate# cat /​etc/​nginx/​sites-available/​user1
 </​code><​code>​ </​code><​code>​
Line 844: Line 901:
  
 # tail /​var/​log/​nginx/​error.log # tail /​var/​log/​nginx/​error.log
 +  или
 +# nginx -t -c /​etc/​nginx/​nginx.conf
  
 # service nginx restart # service nginx restart
 </​code><​code>​ </​code><​code>​
 gate.isp.un$ wget -O - -q http://​server.corpX.un gate.isp.un$ wget -O - -q http://​server.corpX.un
-</​code><​code>​+</​code>​ 
 + 
 +==== Прокси с балансировкой (пример 2) ==== 
 + 
 +<​code>​
 # cat /​etc/​nginx/​sites-available/​myapp1 # cat /​etc/​nginx/​sites-available/​myapp1
 </​code><​code>​ </​code><​code>​
Line 866: Line 929:
 </​code><​code>​ </​code><​code>​
 # ln -s /​etc/​nginx/​sites-available/​myapp1 /​etc/​nginx/​sites-enabled/​myapp1 # ln -s /​etc/​nginx/​sites-available/​myapp1 /​etc/​nginx/​sites-enabled/​myapp1
 +</​code>​
 +
 +==== Прокси "​красивого"​ URL в приложение (пример 3) ====
 +
 +<​code>​
 +# host mail
 +# host webd
 +# host www
 +# host autoconfig
 +# host corpX.un
 +
 +... has address 192.168.X.10
 +
 +root@server#​ cat /​var/​opt/​gitlab/​nginx/​conf/​corpX.conf
 +</​code><​code>​
 +    server {
 +        listen 80;
 +        server_name webd.corpX.un;​
 +
 +        location / {
 +            proxy_pass http://​192.168.49.2:​30111/;​
 +        }
 +    }
 +    server {
 +        listen 80;
 +        server_name mail.corpX.un;​
 +
 +        location / {
 +            proxy_pass http://​server.corpX.un:​81/​mail/;​
 +#            proxy_pass http://​gate.corpX.un:​81/​mail/;​
 +        }
 +    }
 +    server {
 +        listen 80;
 +        server_name corpX.un www.corpX.un;​
 +
 +        location / {
 +            proxy_pass http://​server.corpX.un:​81/;​
 +        }
 +    }
 +#    server {
 +#        listen 80;
 +#        server_name autoconfig.corpX.un;​
 +#        location / {
 +#            proxy_pass http://​gate.corpX.un:​81/;​
 +#        }
 +#    }
 +</​code><​code>​
 +# cat /​etc/​gitlab/​gitlab.rb
 +</​code><​code>​
 +...
 +nginx['​custom_nginx_config'​] = "​include /​var/​opt/​gitlab/​nginx/​conf/​corpX.conf;"​
 +...
 +</​code>​
 +  * [[Инструмент GitLab#​Проверка конфигурации и перезапуск]]
 +<​code>​
 +root@server#​ less /​var/​opt/​gitlab/​nginx/​conf/​nginx.conf
 +</​code><​code>​
 +...
 +  include /​var/​opt/​gitlab/​nginx/​conf/​corpX.conf;​
 +}
 +</​code><​code>​
 +root@server#​ /​opt/​gitlab/​embedded/​sbin/​nginx -p /​var/​opt/​gitlab/​nginx -t
 +</​code><​code>​
 +root@server#​ gitlab-ctl restart nginx
 </​code>​ </​code>​
сервис_http.1632231493.txt.gz · Last modified: 2021/09/21 16:38 by val