Skip to content

Instantly share code, notes, and snippets.

@jeduoliveira
Created June 24, 2022 13:19
Show Gist options
  • Save jeduoliveira/e5f2cd79a07f1353b0e0adcea4ab03d7 to your computer and use it in GitHub Desktop.
Save jeduoliveira/e5f2cd79a07f1353b0e0adcea4ab03d7 to your computer and use it in GitHub Desktop.

Revisions

  1. jeduoliveira created this gist Jun 24, 2022.
    92 changes: 92 additions & 0 deletions apache-httpd-default.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,92 @@
    HostnameLookups Off
    TraceEnable off
    ServerSignature Off
    ServerTokens Prod
    FileETag None
    Timeout 300

    Options +IncludesNOEXEC
    AddType text/html .htm .html .shtm .shtml
    AddOutputFilterByType INCLUDES text/html

    XBitHack on

    Header unset Server
    Header always append X-Frame-Options SAMEORIGIN
    Header unset Upgrade

    Header always set Content-Security-Policy "default-src blob: https: data: 'unsafe-inline' 'unsafe-eval'; img-src * data: blob:; style-src * data: 'unsafe-inline' 'unsafe-eval'; font-src * data: 'unsafe-inline' 'unsafe-eval'; frame-src * data:; connect-src *; object-src * data: 'unsafe-inline' 'unsafe-eval'; script-src * data: 'unsafe-inline' 'self' 'unsafe-eval' blob:;"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Xss-Protection "1; mode=block"
    Header always set Content-Security-Policy "frame-ancestors *"

    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    </IfModule>

    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
    ExpiresByType image/jpg "access plus 5 days"
    ExpiresByType text/css "access plus 1 month"
    </IfModule>

    <IfModule mpm_worker_module>
    ServerLimit 250
    StartServers 10
    MaxRequestWorkers 2490
    MinSpareThreads 100
    MaxSpareThreads 300
    ThreadsPerChild 30
    </IfModule>


    <VirtualHost *:80>
    ServerName STR_SERVER_IP
    DocumentRoot STR_DOCUMENT_ROOT
    DirectoryIndex index.htm

    <Directory STR_DOCUMENT_ROOT>
    Options FollowSymLinks Includes
    AllowOverride None
    Require all granted
    </Directory>

    RewriteEngine on

    RewriteRule ^(.*)\.php$ /lumis/portal/client/images/Pix.gif [R=301,L]
    RewriteRule ^(.*)\.env$ /lumis/portal/client/images/Pix.gif [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !^.*\.wslumis$
    RewriteCond %{HTTP:Connection} ^.*upgrade.* [NC]
    RewriteRule ^(.*) $1.wslumis [PT,env=X-lumWebServer:true]
    RewriteCond %{HTTP:Connection} !^.*upgrade.* [NC]
    RewriteCond %{REQUEST_FILENAME} !^.*\.jsp$
    RewriteCond %{REQUEST_FILENAME} !^.*\.lumis$
    RewriteCond %{REQUEST_FILENAME} ^/(.*)
    RewriteCond STR_DOCUMENT_ROOT/%1 !-f
    RewriteCond STR_DOCUMENT_ROOT/%1/index.htm !-f
    RewriteRule ^(.*) $1.lumis [PT,env=X-lumWebServer:true]

    RequestHeader set X-lumWebServer "apache" env=X-lumWebServer
    Header set X-UA-Compatible "IE=edge" env=!X-lumWebServer

    #Header edit Set-Cookie ^(.*)$ "$1; Secure; SameSite=None"


    ProxyPreserveHost On
    ProxyPassMatch ^/(.*)\.wslumis$ ws://localhost:8080/$1
    ProxyPassMatch ^/(.*\.(?:jsp|lumis))$ ajp://localhost:8009/$1

    </VirtualHost>