SteveClement / mmdb-server

mmdb-server is an open source fast API server to lookup IP addresses for their geographic location.
https://adulau.github.io/mmdb-server/
GNU Affero General Public License v3.0
0 stars 0 forks source link

[doc] Add hints how to use frontend webserver #3

Open SteveClement opened 2 weeks ago

SteveClement commented 3 days ago

Apache/nginx rewrite to custom port of server runinng locally.

SteveClement commented 3 days ago
<VirtualHost *:80>
    ServerAdmin www@localhost.lu
    # non-existen
    DocumentRoot /var/www/www.localhost.lu
    ServerName ip.localhost.lu
    ServerAlias ipv4.localhost.lu ipv6.localhost.lu whatismyipv6.localhost.lu whatsmyipv6.localhost.lu whatsmyip.localhost.lu whatismyip.localhost.lu whatsmyipv4.localhost.lu whatismyipv4.localhost.lu
    ErrorLog /var/log/apache2/ip.localhost.lu-error_log
    CustomLog /var/log/apache2/ip.localhost.lu-access_log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =ip.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =ipv4.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =ipv6.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =whatsmyip.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =whatismyip.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =whatismyipv6.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =whatsmyipv6.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =whatsmyipv4.localhost.lu [OR]
    RewriteCond %{SERVER_NAME} =whatismyipv4.localhost.lu [OR]
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    <Directory />
        Options -Indexes
    </Directory>
    ServerAdmin www@localhost.lu
    # index.html empty
    DocumentRoot /var/www/default-ok
    ServerName ip.localhost.lu
    ServerAlias ipv4.localhost.lu ipv6.localhost.lu whatismyipv6.localhost.lu whatsmyipv6.localhost.lu whatsmyip.localhost.lu whatismyip.localhost.lu whatsmyipv4.localhost.lu whatismyipv4.localhost.lu
    ErrorLog /var/log/apache2/ip.localhost.lu-error_log
    CustomLog /var/log/apache2/ip.localhost.lu-access_log combined
    ProxyRequests Off
    RewriteEngine On
    # Local mmdb-server
    RewriteRule ^/(.*)$ http://127.0.0.1:8111/$1 [P,QSA,L]
    ProxyPassReverse / http://127.0.0.1:8111/

    Header always add Strict-Transport-Security "max-age=15768000"
    #SSLProtocol All -SSLv2 -SSLv3
    RewriteEngine On

    SSLEngine on

    SSLCertificateFile    /etc/ssl/pub/2024/all_certs.localhost.lu.crt
    SSLCertificateKeyFile /etc/ssl/pub/2024/joker.localhost.lu.key
    SSLCertificateChainFile /etc/ssl/pub/2024/int-cert.crt
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch "MSIE [2-6]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    # MSIE 7 and newer should be able to use keepalive
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

    ErrorDocument 404 /404/

</VirtualHost>