Просмотр исходного кода

Closes #11638: add http redirect to apache

rganascim 3 лет назад
Родитель
Сommit
07b0b93256
2 измененных файлов с 10 добавлено и 1 удалено
  1. 9 0
      contrib/apache.conf
  2. 1 1
      docs/installation/5-http-server.md

+ 9 - 0
contrib/apache.conf

@@ -1,3 +1,12 @@
+<VirtualHost *:80>
+    # CHANGE THIS TO YOUR SERVER'S NAME
+    ServerName netbox.example.com
+
+    RewriteEngine On
+    RewriteCond %{HTTPS} !=on
+    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
+</VirtualHost>
+
 <VirtualHost *:443>
 <VirtualHost *:443>
     ProxyPreserveHost On
     ProxyPreserveHost On
 
 

+ 1 - 1
docs/installation/5-http-server.md

@@ -65,7 +65,7 @@ sudo cp /opt/netbox/contrib/apache.conf /etc/apache2/sites-available/netbox.conf
 Finally, ensure that the required Apache modules are enabled, enable the `netbox` site, and reload Apache:
 Finally, ensure that the required Apache modules are enabled, enable the `netbox` site, and reload Apache:
 
 
 ```no-highlight
 ```no-highlight
-sudo a2enmod ssl proxy proxy_http headers
+sudo a2enmod ssl proxy proxy_http headers rewrite
 sudo a2ensite netbox
 sudo a2ensite netbox
 sudo systemctl restart apache2
 sudo systemctl restart apache2
 ```
 ```