Skip to content

apache反向代理配置

ubuntu中的配置

<VirtualHost *:80>
   ServerName gardenengineer.club
   RewriteEngine on
   RewriteCond %{SERVER_NAME} =gardenengineer.club
   RewriteRule ^ http://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
   <VirtualHost *:443>
      ServerName gardenengineer.club

      ProxyRequests Off
      ProxyPass /                    http://localhost:8069/ retry=0
      ProxyPassReverse /             http://localhost:8069/ retry=0
      <Proxy *>
         Order deny,allow
         Allow from all
      </Proxy>
      RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
      RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}

      ProxyVia On
      ProxyPreserveHost On

      RewriteEngine On
      RewriteCond %{HTTP:Upgrade} =websocket [NC]
      RewriteRule /(.*)           ws://127.0.0.1:8069/$1 [P,L]
      RewriteCond %{HTTP:Upgrade} !=websocket [NC]
      RewriteRule /(.*)           http://127.0.0.1:8069/$1 [P,L]


      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
      SSLCertificateFile /etc/letsencrypt/live/gardenengineer.club/fullchain.pem
      SSLCertificateKeyFile /etc/letsencrypt/live/gardenengineer.club/privkey.pem
   </VirtualHost>
</IfModule>

开源系统说明文档