Skip to content

webclubz/archLamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Updated 15 sep 2025

📦 Arch Linux LAMP Stack & Sites Manager

This repository provides helper scripts to install, remove, and manage a local LAMP (Linux, Apache, MariaDB, PHP) stack on Arch Linux.

It also includes a sites-manager tool for easily creating and managing local virtual hosts, with sane permissions and group handling.

After Installation you can also accese to phpMtAdmin. fro every vhost. For example mysite.test - mysite.test/phpmyadmin


⚠️ Before you start

All projects live under ~/Sites and use a shared group (webdev) so that both you and Apache/PHP (http user) can read/write files without permission conflicts.

The first step after installation is to run:

Set tmp dir and sizes in PHP config (either option A or B): A) php.ini (global)

Edit /etc/php/php.ini and set: file_uploads = On upload_tmp_dir = /tmp post_max_size = 20M upload_max_filesize = 20M B) FPM pool override (preferred per‑pool)

Edit /etc/php/php-fpm.d/www.conf and add:

php_admin_value[upload_tmp_dir] = /tmp php_admin_value[post_max_size] = 20M php_admin_value[upload_max_filesize] = 20M

ls -ld /tmp

you should see: drwxrwxrwt ... /tmp (the t at the end = sticky bit, perms 1777)

If it doesn't exist or the perms are wrong:

sudo mkdir -p /tmp sudo chmod 1777 /tmp

sites-manager setup

This will:

  • Ensure the webdev group exists and add both your user and http to it.
  • Create ~/Sites with correct permissions (2775 on dirs, 664 on files).
  • Enable setgid + default ACLs so all new files/folders inherit group webdev.
  • Configure PHP-FPM to run as http:webdev with UMask=0002.
  • Fix $HOME permissions so Apache can traverse into ~/Sites.

👉 After running setup, log out and log back in to apply new group memberships.


📂 Scripts

  • installLamp.sh → Install & configure a hardened LAMP stack (Apache event MPM + PHP-FPM + MariaDB + phpMyAdmin)
  • removeLamp.sh → Completely remove the LAMP stack and related configs
  • sites-manager.sh → Manage your development sites (create, remove, list, fix, check/repair, scaffold Laravel/WordPress, etc.)

🚀 Installation

  1. Clone or copy the scripts

    git clone https://github.com/webclubz/archLamp.git
    cd archLamp
  2. Make them executable

    chmod +x installLamp.sh removeLamp.sh sites-manager.sh
  3. Run installation

    ./installLamp.sh
  4. Run initial setup

    ./sites-manager.sh setup

    Then log out and back in.


🧰 Sites Manager

The sites-manager script simplifies creating and managing local vhosts.

Install sites-manager globally (optional but helpfull)

sudo cp sites-manager.sh /usr/local/bin/sites-manager
sudo chmod +x /usr/local/bin/sites-manager

After you can run in terminal from everywhere like: sites-manager

Usage

sites-manager setup               # One-time setup (create ~/Sites, groups, ACLs, PHP-FPM config)
sites-manager add <site>          # Add new site (auto create dir & vhost)
sites-manager remove <site>       # Remove site & vhost
sites-manager list                # List active sites
sites-manager scan [apply]        # Dry-run (default) or apply to add from ~/Sites
sites-manager fix-cms <site>      # Fix permissions for a specific project (Laravel/WP/etc.)
sites-manager check               # Check for permission/group issues under ~/Sites
sites-manager repair              # Auto-fix permission/group issues under ~/Sites
sites-manager debug <site|domain> # Deep 403 diagnostics (vhost, perms, index, Apache)
sites-manager audit               # List vhosts with missing DocumentRoot
sites-manager prune               # Remove missing vhosts and clean /etc/hosts
sites-manager allow-home          # Allow httpd to read from /home (systemd override)
sites-manager start               # Start Apache + MariaDB
sites-manager stop                # Stop Apache + MariaDB
sites-manager init laravel <s>    # Scaffold new Laravel project + vhost
sites-manager init wp <s>         # Scaffold new WordPress site + vhost

Projects are created under ~/Sites/<site> and served at http://<site>.test.

Scan logic:

  • If <site>/public exists → DocumentRoot is <site>/public; else <site>.
  • Only adds sites where the chosen DocumentRoot contains index.php|html|htm.
  • Skips hidden/underscored dirs and any dir with a .nosite file.

Examples:

# Preview what would be added
sites-manager scan
# Apply changes (create vhosts + hosts entries)
sites-manager scan apply

🗑 Removing LAMP

To remove everything and clean the system (exept Sites folder):

./removeLamp.sh

💡 Tips & Tricks

  • Logs

    sudo journalctl -u httpd -f
    tail -f /var/log/httpd/<site>_error.log
  • MariaDB security

    sudo mariadb-secure-installation
  • phpMyAdmin http://localhost/phpmyadmin

  • Quick restart

    sites-manager stop && sites-manager start
  • Laravel after init

    cd ~/Sites/blog
    php artisan migrate
    php artisan serve
  • WordPress with DB env vars

    WP_DB_NAME=wp_blog WP_DB_USER=root WP_DB_PASS=secret sites-manager init wp blog
  • Check/fix permissions

    sites-manager check   # list any issues
    sites-manager repair  # fix all issues
  • Troubleshoot 403 after system updates

    Recent Arch updates enable systemd hardening for Apache (ProtectHome=on), which hides /home from httpd. If your sites live under ~/Sites, enable read access:

    sites-manager allow-home

    Then verify a site:

    sites-manager debug mysite

    If needed, switch to full access by setting ProtectHome=false in /etc/systemd/system/httpd.service.d/override.conf and restarting httpd.

  • SSL for local dev Use mkcert for HTTPS on .test domains.


⚡ Quickstart Examples

Laravel (zero to running in 3 steps)

sites-manager init laravel blog
xdg-open http://blog.test

WordPress (with DB auto-config)

WP_DB_NAME=wp_blog WP_DB_USER=root WP_DB_PASS=secret sites-manager init wp blog
xdg-open http://blog.test

✅ Requirements

  • Arch Linux (or Arch-based distro)
  • sudo privileges
  • Internet access (for pacman, composer, wp-cli)
  • acl package (for proper permission inheritance)

⚠️ Disclaimer

This is a personal project created for learning and convenience in local development environments. The scripts are provided as-is without any guarantees or warranties. Use them at your OWN RISK. I am not responsible for any data loss, misconfiguration, or damage that may result from using these scripts on your system. Always review and adapt the code to your specific needs before running it on production or critical environments.

About

Arch Linux helper scripts to install, remove, and manage a local LAMP (Apache, MariaDB, PHP 8.4, phpMyAdmin) stack on Arch Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages