-
-
Save allanphilipbarku/31438a3f483647007e23e3a570ac43fd to your computer and use it in GitHub Desktop.
VueJS: Apache with forced https and http2 / Nginx vhost config examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
Protocols h2 h2c http/1.1 | |
ServerName vuejs.project-url.com | |
ServerAdmin webmaster@vuejs.project-url.com | |
DocumentRoot /var/www/html/projec-root-directory/dist/ | |
<Directory "/var/www/html/projec-root-directory/dist/"> | |
AllowOverride All | |
Options FollowSymLinks Multiviews Indexes | |
Require all granted | |
</Directory> | |
ErrorLog "/var/log/apache2/vuejs-error_log" | |
CustomLog "/var/log/apache2/vuejs-access_log" common | |
RewriteEngine on | |
RewriteCond %{SERVER_NAME} =vuejs.project-url.com [OR] | |
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] | |
</VirtualHost> | |
<VirtualHost *:443> | |
Protocols h2 h2c http/1.1 | |
ServerAdmin webmaster@vuejs.project-url.com | |
ServerName vuejs.project-url.com | |
DocumentRoot /var/www/html/projec-root-directory/dist/ | |
<Directory "/var/www/html/projec-root-directory/dist/"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride all | |
Require all granted | |
Order allow,deny | |
allow from all | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.html$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.html [L] | |
</IfModule> | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/vuejs-ssl-error.log | |
CustomLog ${APACHE_LOG_DIR}/vuejs-ssl-access.log comb$ | |
SSLEngine on | |
SSLCertificateFile /etc/ssl/certificate.crt | |
SSLCertificateKeyFile /etc/ssl/certificate.key | |
SSLCACertificateFile /etc/ssl/certificate.ca-bundle | |
<FilesMatch "\.(cgi|shtml|phtml|php)$"> | |
SSLOptions +StdEnvVars | |
</FilesMatch> | |
<Directory /usr/lib/cgi-bin> | |
SSLOptions +StdEnvVars | |
</Directory> | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen 443; | |
ssl on; | |
ssl_protocols TLSv1 TLSv1.2; | |
ssl_ciphers ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128; | |
ssl_ecdh_curve secp384r1; | |
ssl_prefer_server_ciphers on; | |
ssl_certificate /etc/nginx/ssl/nginx.crt; | |
ssl_certificate_key /etc/nginx/ssl/nginx.key; | |
add_header Access-Control-Allow-Origin *; | |
root /home/dev/server/project/dist/; | |
server_name vuejs.project.local | |
index index.html; | |
location / { | |
try_files $uri $uri/ @rewrites; | |
} | |
location @rewrites { | |
rewrite ^(.+)$ /index.html last; | |
} | |
location ~* .(?:ico|css|js|gif|jpe?g|png)$ { | |
expires max; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment