Skip to content

Instantly share code, notes, and snippets.

@taufik-nurrohman
Last active April 23, 2022 16:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save taufik-nurrohman/1da313a2db48a26d836d781258b6c139 to your computer and use it in GitHub Desktop.
Using Mecha under Nginx instead of Apache web server.
server {
listen 443 ssl;
root /path/to/www;
index index.php index.html;
server_name mecha-cms.com;
# access_log /path/to/www/access-logs/access.log;
# error_log /path/to/www/access-logs/error.log;
# include /etc/letsencrypt/options-ssl-nginx.conf;
charset utf-8;
location = /ads.txt {
allow all;
}
location = /favicon.ico {
allow all;
}
# Google’s site verification file must be accessible in public!
# Replace `XXXXXXXXXXXXXXXXX` with your original file suffix
location = /googleXXXXXXXXXXXXXXXXX.html {
allow all;
}
location = /robots.txt {
allow all;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ^~ /engine/ {
deny all;
return 403;
}
location ^~ /lot/ {
deny all;
return 403;
}
location ^~ /lot/asset/ {
allow all;
}
location ^~ /lot/[xy]/[^/]+/.*?\.(css|gif|jpe?g|js|a?png|svg)$ {
allow all;
}
location ~ /\. {
deny all;
return 403;
}
location ~ \.php$ {
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_intercept_errors on;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment