Skip to content

Leafpub on Nginx

Marc Apfelbaum edited this page Jun 3, 2018 · 1 revision

Leafpub is developed and tested on Apache, but there's nothing stopping you from using another web server. NGINX is a popular alternative 

Here's a sample config that will get you up and running in no time, courtesy of @calmdev:

server {
  listen                *:80;
  server_name           _example.com_;
  access_log            _/path/to/example.com_.access.log;
  error_log             _/path/to/example.com_.error.log;

  location / {
    root  _/path/to/example.com/app_;
    try_files  $uri  $uri/  /index.php?$args;
    index index.php;
  }

  location ~ /(backups) {
    deny all;
  }

  location ~ \.php$ {
    root  _/path/to/example.com/app_;
    try_files  $uri  $uri/  /index.php?$args;
    index  index.html index.htm index.php;

    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_intercept_errors on;
    include fastcgi_params;
  }
}

Once you've setup NGINX, copy over your existing Leafpub site or run the installer as usual.

Need help getting things setup? Try asking on the community forum!

Clone this wiki locally