Git Product home page Git Product logo

lcmp-on-nix's Introduction

LCMP-on-Nix

Importable NixOS configuration for Caddy with SQL and PHP-FPM - easily deploy native Wordpress with Nix

What does this software do?

This software is a single Nix / NixOS module that deploys Caddy with PHP-FPM under the www-data user, and a blank MariaDB SQL Server

The goal of this software was to streamline the deployment of Wordpress, Drupal, or any PHP-FPM compatible app instance, without needing to use full NixOS Wordpress services. This module lets you deploy the base server so that you can put any PHP-FPM application in the folder, define the hostname, and it should "just work"

This software has been tested with Wordpress, and it works as intended as long as the wordpress folder permissions are set correctly. This will allow you to import your existing Wordpress sites into your NixOS server with minimal wrestling with expressions. Note that although the config use's nixOS's immutability, the Wordpress base files need to be manually put in the directory that you specifiy in the NixOS file This is by design, as it lets you very easily and quickly switch from something like Ubuntu Server to NixOS for hosting your sites.

Note: I am not responsible for anything that you choose do with it, and this file is MIT Licensed - but if you find any bugs or issues feel free to open a ticket!

How do I deploy this on my NixOS / Nix Server?

There are a number of ways you can add this to your NixOS / Nix server. Namely:

  1. Copy & Paste the content of LCMP.nix into your configuration.nix

  2. Import LCMP.nix into your Nix file directory (usually /etc/nixos) and add it to your list of imports like so:

    imports = [
     ./hardware-configuration.nix
     ./LCMP.nix
     # Other imported .nix files go here
     ];
    

Once you have the file imported as intended thru your preferred method, you will need to set the following values:

  1. Your Virtualhost URL - This is set as example.com inside of LCMP.nix but you will need to set it to your website or webapp's URL so Caddy can setup automatic SSL
  2. Your files directory - This is set as /var/www/example but you will need to set it to your website or webapps files folder. For wordpress, this would be the location of your wordpress install - the directory where your wp-config.php files and whatnot usually live.

Note, you can add as many virtualhosts as you'd like, by adding them to the caddy section. NixOS's official wiki has good instructions on that here

Post deployment instructions

You will need to create whatever database you require for your webapp, you can do this as root with mysql -u root -p and then hit enter (make sure to set your mysql password for security)

You will also need to set your webapp folder's and file permissions appropiately depending on what it is (Wordpress, Drupal, etc), this is outside of the scope of this file but there are plenty of scripts online that handle this for your specific use case.

lcmp-on-nix's People

Contributors

jackpala avatar

Stargazers

Justin Quaintance avatar Mike Wassmer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.