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
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
sudo mkdir -p /tmp sudo chmod 1777 /tmp
sites-manager setupThis will:
- Ensure the
webdevgroup exists and add both your user andhttpto it. - Create
~/Siteswith correct permissions (2775on dirs,664on files). - Enable setgid + default ACLs so all new files/folders inherit group
webdev. - Configure PHP-FPM to run as
http:webdevwithUMask=0002. - Fix
$HOMEpermissions so Apache can traverse into~/Sites.
👉 After running setup, log out and log back in to apply new group memberships.
installLamp.sh→ Install & configure a hardened LAMP stack (Apache event MPM + PHP-FPM + MariaDB + phpMyAdmin)removeLamp.sh→ Completely remove the LAMP stack and related configssites-manager.sh→ Manage your development sites (create, remove, list, fix, check/repair, scaffold Laravel/WordPress, etc.)
-
Clone or copy the scripts
git clone https://github.com/webclubz/archLamp.git cd archLamp -
Make them executable
chmod +x installLamp.sh removeLamp.sh sites-manager.sh
-
Run installation
./installLamp.sh
-
Run initial setup
./sites-manager.sh setup
Then log out and back in.
The sites-manager script simplifies creating and managing local vhosts.
sudo cp sites-manager.sh /usr/local/bin/sites-manager
sudo chmod +x /usr/local/bin/sites-managerAfter you can run in terminal from everywhere like: sites-manager
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 + vhostProjects are created under ~/Sites/<site> and served at http://<site>.test.
Scan logic:
- If
<site>/publicexists → 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
.nositefile.
Examples:
# Preview what would be added
sites-manager scan
# Apply changes (create vhosts + hosts entries)
sites-manager scan applyTo remove everything and clean the system (exept Sites folder):
./removeLamp.sh-
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/homefrom 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=falsein/etc/systemd/system/httpd.service.d/override.confand restarting httpd. -
SSL for local dev Use mkcert for HTTPS on
.testdomains.
sites-manager init laravel blog
xdg-open http://blog.testWP_DB_NAME=wp_blog WP_DB_USER=root WP_DB_PASS=secret sites-manager init wp blog
xdg-open http://blog.test- Arch Linux (or Arch-based distro)
sudoprivileges- Internet access (for pacman, composer, wp-cli)
aclpackage (for proper permission inheritance)
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.