DEV Community

Bogdan Alexandru Militaru
Bogdan Alexandru Militaru

Posted on • Originally published at boobo94.github.io on

How to serve a JavaScript build with Apache

To serve a JavaScript build with Apache is a very simple task and today I want to present you a very simple way of achieving that.

<VirtualHost *:80>
        ServerName subdomain1.example.com
        ServerAlias subdomain2.example.com

        RewriteEngine on
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName subdomain1.example.com
        ServerAlias subdomain2.example.com

        DocumentRoot /var/vhosts/www/client
        <Directory />
                DirectoryIndex index.html
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>
Enter fullscreen mode Exit fullscreen mode

If you consider this helpful please give it a share. For any question or discussion please consider the comments section.

The post How to serve a JavaScript build with Apache appeared first on boobo94.

Top comments (0)