Skip to content

Instantly share code, notes, and snippets.

@mcnaveen
Created July 14, 2021 16:39
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 mcnaveen/72f1b4b969abbfca2d1da0fc0b87a630 to your computer and use it in GitHub Desktop.
Save mcnaveen/72f1b4b969abbfca2d1da0fc0b87a630 to your computer and use it in GitHub Desktop.
Nginx Configuration for Mautic (Non Docker Installation)
server {
listen 80;
server_name YOURDOMAIN NAME;
root /var/www/mautic;
listen 443 ssl http2;
listen [::]:443 ssl http2;
access_log /var/log/nginx/mautic-access.log;
error_log /var/log/nginx/mautic-error.log;
index index.html index.htm index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 240;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/.+)$;
}
rewrite ^themes/.*/(layouts|pages|partials)/.*.htm /index.php break;
rewrite ^bootstrap/.* /index.php break;
rewrite ^config/.* /index.php break;
rewrite ^vendor/.* /index.php break;
rewrite ^storage/cms/.* /index.php break;
rewrite ^storage/logs/.* /index.php break;
rewrite ^storage/framework/.* /index.php break;
rewrite ^storage/temp/protected/.* /index.php break;
rewrite ^storage/app/uploads/protected/.* /index.php break;
#REMOVE HASH FROM BELOW LINES AFTER GENERATING CERTIFICATES
#Certificate can be Generated with (certbot certonly --nginx)
#ssl_certificate /etc/letsencrypt/live/YOUR-DOMAIN-NAME/fullchain.pem; # managed by Certbot
#ssl_certificate_key /etc/letsencrypt/live/YOUR-DOMAIN-NAME/privkey.pem; # managed by Certbot
#include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment