If it is used to build a website, I still recommend using Nginx. Because I used to be an Apache user, many people say that Nginx is very strong in handling static requests, while Apache is stronger in terms of stability. However, during the process of building a website, I still find Nginx more convenient to use.

Most of the popular server panels on the market now use the Apache architecture, such as VestaCP, ISPConfig, BT.cn pagoda panel, etc. Even the two famous Nginx one-click installation packages, OneinStack and LNMP, also provide LAMP mode, which can be used Install Apache website building environment.

Today I will share a one-click installation package LAMP.sh built in the Apache website building environment. The author is teddysun. The three previous free tools to help you detect the authenticity of the VPS server and the one-click test VPS performance script are from this author. Hands on, and many friends must have used his B#B@R one-click installation package.

For more free server control panels, you can check out my special summary: Server Control Panel List. For more webmaster tools:

  1. Comparison of three excellent online file managers (directory list) - Directory Lister, h5ai and FileRun
  2. Three major reasons why I gave up Tencent Alibaba Cloud enterprise email - Attached is a summary of domestic and foreign enterprise (domain name) email addresses
  3. VPS mounts domestic and foreign network disks to achieve free expansion tools: Rclone, COS-Fuse and OSSFS

1. LAMP.sh installation

The LAMP one-click installation package is a shell program written in Linux Shell that can install the LAMP (Linux + Apache + MySQL/MariaDB/Percona + PHP) production environment for VPS or servers in CentOS/Debian/Ubuntu systems.

Website: https://lamp.sh/

Project: https://github.com/teddysun/lamp

1.1  Installation Requirements

Currently, PHP, Apache, MysqL, MariaDB, etc. provided by LAMP.sh have been updated to the latest versions and support Let’s Encrypt free certificates.

system requirement

System support: CentOS 6+/Debian 7+/Ubuntu 12+

Memory requirements: ≥ 512MB

Hard drive requirements: at least 5GB of remaining space

The server must be configured with software source and connected to the external network

Must have system root access

Strongly recommend to use new system to install

Support components

Support PHP comes with almost all components

Support MySQL, MariaDB, Percona Server database

Supports Redis (optional installation)

Supports XCache (optional installation)

Supports Swoole (optional installation)

Supports Memcached (optional installation)

Supports ImageMagick (optional installation)

Supports GraphicsMagick (optional installation)

Supports ZendGuardLoader (optional installation)

Supports ionCube Loader (optional installation)

Self-service upgrade of Apache, PHP, phpMyAdmin, MySQL/MariaDB/Percona Server to the latest version

Add a new virtual host on the command line (use the lamp command), easy to operate

Support one-click uninstall

1.2  Installation steps

Preparation (install wget, screen, unzip, create screen session)

yum -y install wget screen git      // for CentOS
apt-get -y install wget screen git  // for Debian/Ubuntu

git clone and give the script execution permissions

git clone https://github.com/teddysun/lamp.git
cd lamp
chmod +x *.sh

start installation

screen -S lamp
./lamp.sh

During the installation process, you will be asked to choose Apache, PHP, MysqL and other versions.

Related components can also be installed together.

Finally, when you see the following prompt, the installation is successful.

2. Use of LAMP.sh

2.1  Virtual host management

To add a virtual host to LAMP.sh, you need to enter the command tool and add it manually. The command is as follows:

lamp add      创建虚拟主机
lamp del      删除虚拟主机
lamp list     列出虚拟主机

During the adding process, you will be asked to bind the domain name, set the database account and password, etc. In addition, if you want to turn on Let’s Encrypt with one click, you need to perform DNS resolution on the domain name in advance, and then select the Let’s Encrypt certificate option when adding the virtual host.

This is the host successfully created by LAMP.sh, and the SSL certificate is automatically added.

2.2  Program Upgrades and Catalog

How to upgrade:

git pull                 // Get latest version
./upgrade.sh             // Select one to upgrade
./upgrade.sh apache      // Upgrade Apache
./upgrade.sh db          // Upgrade MySQL/MariaDB/Percona
./upgrade.sh php         // Upgrade PHP
./upgrade.sh phpmyadmin  // Upgrade phpMyAdmin

How to uninstall

./uninstall.sh 

Program directory

MySQL installation directory: /usr/local/mysql

MySQL database directory: /usr/local/mysql/data (default, the path can be changed during installation)

MariaDB installation directory: /usr/local/mariadb

MariaDB database directory: /usr/local/mariadb/data (default, the path can be changed during installation)

Percona installation directory: /usr/local/percona

Percona database directory: /usr/local/percona/data (default, the path can be changed during installation)

PHP installation directory: /usr/local/php

Apache installation directory: /usr/local/apache

2.3  Related command tools

MySQL or MariaDB or Percona command

/etc/init.d/mysqld (start|stop|restart|status)

Apache commands

/etc/init.d/httpd (start|stop|restart|status)

Memcached command (optional installation)

/etc/init.d/memcached (start|stop|restart|status)

Redis commands (optional installation)

/etc/init.d/redis-server (start|stop|restart|status)

Website root directory . Default website root directory: /data/www/default.

3. LAMP.sh problem

First problem: Unable to enable HTTP 2. Although the LAMP.sh official website says that Http 2 is supported by default, when the virtual host is created and accessed, it is still Http 1.1. I don’t know why.

Second question: 301 redirect. This should not be a problem with LAMP.sh itself. If you want to jump all Http to Https, you also need to add the 301 jump code to .Htaccess after creating the virtual host. The following is a piece of code that jumps all http requests to Https://wzfou.com. (Note that www requests also jump to non-www)


<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
    RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
</ifmodule>

4. Summary

Compared with OneinStack and LNMP, LAMP.sh focuses on providing Apache website building scripts, and the author has been adding the latest versions and features of Apache, PHP and MysqL, which can basically satisfy everyone's needs for Apache website building and LAMP. need.

When the LAMP.sh script is installed, if the RAM + Swap capacity is less than 480MB, it will directly exit the script. In addition, if you want a Web panel to be used with LAMP.sh, you can try the powerful Virtualmin/Webmin Server management panel, remember to just install Webmin.

Leave a Reply