apache 反向代理 80轉443轉8080

URL Link //n.sfs.tw/12281

2018-03-21 14:47:08 By igogo

apache 服務 80 轉443 再轉 8080

 

以centos 7 為平臺

 

/etc/httpd/conf.d/ssoid.conf

#Listen 443 https
RewriteEngine On
# This will enable the Rewrite capabilities
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS

<VirtualHost *:80>
    DocumentRoot /var/www/html
    ServerName ssoid.tc.edu.tw
    <Directory "/var/www/html">
        Options -Indexes
        AllowOverride All
        Require all granted
    </Directory>
# RewriteCond %{HTTPS} off
# RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteEngine on
RewriteCond %{SERVER_NAME} =ssoid.tc.edu.tw
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

 

所有輸入ssoid.tc.edu.tw 者  皆轉向 https

 

/etc/httpd/conf.d/ssl.conf

<VirtualHost _default_:443>

略...

 <Location />
     ProxyPass "http://127.0.0.1:8080/"
     ProxyPassReverse "http://127.0.0.1:8080/"
     Order deny,allow
     Allow from all
  </Location>


 <Location /app2>
     ProxyPass "http://127.0.0.1:8081/"
     ProxyPassReverse "http://127.0.0.1:8081/"
     Order deny,allow
     Allow from all
  </Location>

</VirtualHost>

 

https://xxx/app2 ;; 轉到內部的8081服務