Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fiko/8fdd25da39ed4441f566acc5fe7c2ca0 to your computer and use it in GitHub Desktop.
Save fiko/8fdd25da39ed4441f566acc5fe7c2ca0 to your computer and use it in GitHub Desktop.
Basic Apache Configuration
ServerAdmin hi@fiko.me
DocumentRoot /home/fiko/sites/project/middleman/public/
ServerName project.dev.fiko.me
#ServerAlias www.domain.com
<Directory /home/fiko/sites/project/middleman/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
# From the Apache version 2.4.10 and above, use the SetHandler to run PHP as a fastCGI process server
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerAdmin hi@fiko.me
DocumentRoot /home/fiko/sites/project/pub/
ServerName project.dev.fiko.me
#ServerAlias www.domain.com
<Directory /home/fiko/sites/project/pub/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
# From the Apache version 2.4.10 and above, use the SetHandler to run PHP as a fastCGI process server
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<VirtualHost *:80>
Include /etc/apache2/sites-available/project-magento.conf
# Redirect to https (generated by certbot --apache --redirect)
RewriteEngine on
RewriteCond %{SERVER_NAME} =project.dev.fiko.me
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# https (generated by certbot --apache --redirect on separated file: project-le-ssl.conf)
<IfModule mod_ssl.c>
<VirtualHost *:443>
Include /etc/apache2/sites-available/project-magento.conf
SSLCertificateFile /etc/letsencrypt/live/project.dev.fiko.me/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/project.dev.fiko.me/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment